forked from TrueCloudLab/frostfs-node
[#1517] cli: Print the reason of ape manager error
Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
This commit is contained in:
parent
99f9e59de9
commit
1ed7ab75fb
1 changed files with 7 additions and 2 deletions
|
@ -26,6 +26,7 @@ func ExitOnErr(cmd *cobra.Command, errFmt string, err error) {
|
||||||
_ = iota
|
_ = iota
|
||||||
internal
|
internal
|
||||||
aclDenied
|
aclDenied
|
||||||
|
apemanagerDenied
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -33,6 +34,7 @@ func ExitOnErr(cmd *cobra.Command, errFmt string, err error) {
|
||||||
|
|
||||||
internalErr = new(sdkstatus.ServerInternal)
|
internalErr = new(sdkstatus.ServerInternal)
|
||||||
accessErr = new(sdkstatus.ObjectAccessDenied)
|
accessErr = new(sdkstatus.ObjectAccessDenied)
|
||||||
|
apemanagerErr = new(sdkstatus.APEManagerAccessDenied)
|
||||||
)
|
)
|
||||||
|
|
||||||
switch {
|
switch {
|
||||||
|
@ -41,6 +43,9 @@ func ExitOnErr(cmd *cobra.Command, errFmt string, err error) {
|
||||||
case errors.As(err, &accessErr):
|
case errors.As(err, &accessErr):
|
||||||
code = aclDenied
|
code = aclDenied
|
||||||
err = fmt.Errorf("%w: %s", err, accessErr.Reason())
|
err = fmt.Errorf("%w: %s", err, accessErr.Reason())
|
||||||
|
case errors.As(err, &apemanagerErr):
|
||||||
|
code = apemanagerDenied
|
||||||
|
err = fmt.Errorf("%w: %s", err, apemanagerErr.Reason())
|
||||||
default:
|
default:
|
||||||
code = internal
|
code = internal
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue