Skip to content

Misleading documentation on status.FromError #4066

Closed
@yvesf

Description

The current documentation is:

// FromError returns a Status representing err if it was produced from this
// package or has a method `GRPCStatus() *Status`. Otherwise, ok is false and a
// Status is returned with codes.Unknown and the original error message.

The first statement is not true because the implementation does return nil, true if the err is nil.

The documentation could be improved to avoid that this function is used in wrong ways when not looking at the actual implementation.

What did you expect to see?

// FromError returns a Status representing err if it was produced from this
// package or has a method `GRPCStatus() *Status`. 
// If err is nil then Status nil will be returned and ok is true. Otherwise, ok is false and a
// Status is returned with codes.Unknown and the original error message.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions