feat(client-go): typed Unauthenticated vs PermissionDenied errors (#198)
Every RPC failure surfaced as a GatewayError with no way to tell a rejected key from a missing scope, though docs/ClientLibrariesDesign.md requires the two be treated distinctly. GatewayError now matches the new sentinels ErrUnauthenticated and ErrPermissionDenied via errors.Is (by gRPC status code only, so it works through the secret-redaction wrapper) and exposes Code(). Tests: errors_auth_test.go — sentinel matching per code, Code(), and a bufconn AcknowledgeAlarm round trip proving the match survives the wire and the password stays redacted (both behavioural tests fail without GatewayError.Is).
This commit is contained in:
@@ -146,7 +146,10 @@ type MxAccessError struct { ... }
|
||||
```
|
||||
|
||||
Use `errors.Is` / `errors.As` support. Preserve raw protobuf replies on command
|
||||
errors.
|
||||
errors. `GatewayError` matches the sentinels `ErrUnauthenticated` and
|
||||
`ErrPermissionDenied` through `errors.Is` by gRPC status code, so callers treat
|
||||
the two authorization failures distinctly (`docs/ClientLibrariesDesign.md`)
|
||||
without parsing messages.
|
||||
|
||||
## Test CLI
|
||||
|
||||
|
||||
Reference in New Issue
Block a user