StatusErrEqual returns true iff both err1 and err2 wrap status.Status errors and their underlying status protos are equal.
(err1, err2 error)
| 26 | // StatusErrEqual returns true iff both err1 and err2 wrap status.Status errors |
| 27 | // and their underlying status protos are equal. |
| 28 | func StatusErrEqual(err1, err2 error) bool { |
| 29 | status1, ok := status.FromError(err1) |
| 30 | if !ok { |
| 31 | return false |
| 32 | } |
| 33 | status2, ok := status.FromError(err2) |
| 34 | if !ok { |
| 35 | return false |
| 36 | } |
| 37 | return proto.Equal(status1.Proto(), status2.Proto()) |
| 38 | } |