From 8b482fc13c74f644576d04a9ba995b83cc9798de Mon Sep 17 00:00:00 2001 From: Miguel Martinez Date: Tue, 30 Sep 2025 17:48:49 +0200 Subject: [PATCH] fix(cli): return consistent authentication error Signed-off-by: Miguel Martinez --- app/cli/main.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/app/cli/main.go b/app/cli/main.go index 9189df0bc..f7c8d042c 100644 --- a/app/cli/main.go +++ b/app/cli/main.go @@ -106,7 +106,14 @@ func errorInfo(err error, logger zerolog.Logger) (string, int) { return msg, exitCode } -func isWrappedErr(grpcStatus *status.Status, err *errors.Error) bool { - target := errors.FromError(grpcStatus.Err()) +// target is the expected error +// grpcStatus is the actual error that might be wrapped in both the status and the error +func isWrappedErr(grpcStatus *status.Status, target *errors.Error) bool { + err := errors.FromError(grpcStatus.Err()) + // The error might be wrapped since the CLI sometimes returns a wrapped error + if errors.Is(err, target) { + return true + } + return target.Code == err.Code && err.Message == target.Message }