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 (
|
const (
|
||||||
_ = iota
|
_ = iota
|
||||||
internal
|
internal
|
||||||
|
aclDenied
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
code int
|
code int
|
||||||
|
|
||||||
internalErr = new(sdkstatus.ServerInternal)
|
internalErr = new(sdkstatus.ServerInternal)
|
||||||
|
accessErr = new(sdkstatus.ObjectAccessDenied)
|
||||||
)
|
)
|
||||||
|
|
||||||
switch {
|
switch {
|
||||||
case errors.As(err, &internalErr):
|
case errors.As(err, &internalErr):
|
||||||
code = internal
|
code = internal
|
||||||
|
case errors.As(err, &accessErr):
|
||||||
|
code = aclDenied
|
||||||
|
err = fmt.Errorf("%w: %s", err, accessErr.Reason())
|
||||||
default:
|
default:
|
||||||
code = internal
|
code = internal
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue