forked from TrueCloudLab/frostfs-node
[#1252] neofs-cli: Print details for AccessDenied errors
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
parent
2848001dfb
commit
32badab11a
1 changed files with 5 additions and 0 deletions
|
@ -515,17 +515,22 @@ func exitOnErr(cmd *cobra.Command, err error) {
|
|||
const (
|
||||
_ = iota
|
||||
internal
|
||||
aclDenied
|
||||
)
|
||||
|
||||
var (
|
||||
code int
|
||||
|
||||
internalErr = new(sdkstatus.ServerInternal)
|
||||
accessErr = new(sdkstatus.ObjectAccessDenied)
|
||||
)
|
||||
|
||||
switch {
|
||||
case errors.As(err, &internalErr):
|
||||
code = internal
|
||||
case errors.As(err, &accessErr):
|
||||
code = aclDenied
|
||||
err = fmt.Errorf("%w: %s", err, accessErr.Reason())
|
||||
default:
|
||||
code = internal
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue