Skip to content

Commit

Permalink
status: document nil error handling of FromError (#4196)
Browse files Browse the repository at this point in the history
Signed-off-by: Gaurav Gahlot <gauravgahlot0107@gmail.com>
  • Loading branch information
gauravgahlot committed Feb 9, 2021
1 parent 9280052 commit 61962d0
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions status/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,11 @@ func FromProto(s *spb.Status) *Status {
return status.FromProto(s)
}

// 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.
// FromError returns a Status representing err if it was produced by this
// package or has a method `GRPCStatus() *Status`.
// If err is nil, a Status is returned with codes.OK and no message.
// Otherwise, ok is false and a Status is returned with codes.Unknown and
// the original error message.
func FromError(err error) (s *Status, ok bool) {
if err == nil {
return nil, true
Expand Down

0 comments on commit 61962d0

Please sign in to comment.