Skip to content

Commit 61962d0

Browse files
authored
status: document nil error handling of FromError (#4196)
Signed-off-by: Gaurav Gahlot <gauravgahlot0107@gmail.com>
1 parent 9280052 commit 61962d0

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

status/status.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,11 @@ func FromProto(s *spb.Status) *Status {
7373
return status.FromProto(s)
7474
}
7575

76-
// FromError returns a Status representing err if it was produced from this
77-
// package or has a method `GRPCStatus() *Status`. Otherwise, ok is false and a
78-
// Status is returned with codes.Unknown and the original error message.
76+
// FromError returns a Status representing err if it was produced by this
77+
// package or has a method `GRPCStatus() *Status`.
78+
// If err is nil, a Status is returned with codes.OK and no message.
79+
// Otherwise, ok is false and a Status is returned with codes.Unknown and
80+
// the original error message.
7981
func FromError(err error) (s *Status, ok bool) {
8082
if err == nil {
8183
return nil, true

0 commit comments

Comments
 (0)