Print the reason of ape manager error #1517

Merged
dstepanov-yadro merged 1 commit from aarifullin/frostfs-node:fix/cli_apemngr into master 2024-11-22 13:45:56 +00:00
Showing only changes of commit 1ed7ab75fb - Show all commits

View file

@ -26,6 +26,7 @@ func ExitOnErr(cmd *cobra.Command, errFmt string, err error) {
_ = iota
internal
aclDenied
apemanagerDenied
)
var (
@ -33,6 +34,7 @@ func ExitOnErr(cmd *cobra.Command, errFmt string, err error) {
internalErr = new(sdkstatus.ServerInternal)
accessErr = new(sdkstatus.ObjectAccessDenied)
apemanagerErr = new(sdkstatus.APEManagerAccessDenied)
)
switch {
@ -41,6 +43,9 @@ func ExitOnErr(cmd *cobra.Command, errFmt string, err error) {
case errors.As(err, &accessErr):
code = aclDenied
err = fmt.Errorf("%w: %s", err, accessErr.Reason())
case errors.As(err, &apemanagerErr):
code = apemanagerDenied
err = fmt.Errorf("%w: %s", err, apemanagerErr.Reason())
default:
code = internal
}