target is the expected error grpcStatus is the actual error that might be wrapped in both the status and the error NOTE: We intentionally do NOT use kratos errors.Is() here because it only compares Code and Reason. Since all JWT errors share the same Code (401) and Reason ("UNAUTHORIZED"), errors.I
(grpcStatus *status.Status, target *errors.Error)
| 138 | // JWT sentinel — causing e.g. "token invalid" to be reported as "token expired". |
| 139 | // Instead we compare Code and Message, which carry the distinguishing text. |
| 140 | func isWrappedErr(grpcStatus *status.Status, target *errors.Error) bool { |
| 141 | err := errors.FromError(grpcStatus.Err()) |
| 142 | return target.Code == err.Code && err.Message == target.Message |
| 143 | } |
| 144 | |
| 145 | // isUnmatchedAuthErr returns true when the gRPC status represents an |
| 146 | // Unauthenticated (401-equivalent) error that was not matched by any of the |
no outgoing calls