MCPcopy Create free account
hub / github.com/chainloop-dev/chainloop / isWrappedErr

Function isWrappedErr

app/cli/main.go:140–143  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.
140func 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

Callers 4

TestIsWrappedErrFunction · 0.85
errorInfoFunction · 0.85

Calls

no outgoing calls

Tested by 3

TestIsWrappedErrFunction · 0.68