IsNeedUserAuthorizationError reports whether err represents a missing-UAT failure. It matches the legacy *NeedAuthorizationError sentinel, which is preserved in the Cause chain of the typed missing-UAT error, so errors.As traverses into the typed *errs.AuthenticationError as well.
(err error)
| 53 | // preserved in the Cause chain of the typed missing-UAT error, so errors.As |
| 54 | // traverses into the typed *errs.AuthenticationError as well. |
| 55 | func IsNeedUserAuthorizationError(err error) bool { |
| 56 | if err == nil { |
| 57 | return false |
| 58 | } |
| 59 | |
| 60 | var needAuthErr *NeedAuthorizationError |
| 61 | return errors.As(err, &needAuthErr) |
| 62 | } |
| 63 | |
| 64 | // SecurityPolicyError is preserved as a Go type alias so existing |
| 65 | // errors.As(&SecurityPolicyError{}) consumers (cmd/root.go etc.) keep working. |