Err returns an immutable error representing s; returns nil if s.Code() is OK.
()
| 123 | |
| 124 | // Err returns an immutable error representing s; returns nil if s.Code() is OK. |
| 125 | func (s *Status) Err() error { |
| 126 | if s.Code() == codes.OK { |
| 127 | return nil |
| 128 | } |
| 129 | return &Error{s: s} |
| 130 | } |
| 131 | |
| 132 | // WithDetails returns a new status with the provided details messages appended to the status. |
| 133 | // If any errors are encountered, it returns nil and the first error encountered. |