Skip to content

Commit

Permalink
cli: Handle client's internal server error according to NeoFS SDK RC-9
Browse files Browse the repository at this point in the history
We don't have to use `errors.As` to just check error type now,
`errors.Is` is more appropriate for this.

Signed-off-by: Leonard Lyubich <[email protected]>
  • Loading branch information
cthulhu-rider committed Aug 3, 2023
1 parent f728cf3 commit 6cedb25
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions cmd/neofs-cli/internal/common/exit.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,11 @@ func ExitOnErr(cmd *cobra.Command, errFmt string, err error) {
aclDenied
)

var (
code int

internalErr = new(sdkstatus.ServerInternal)
accessErr = new(sdkstatus.ObjectAccessDenied)
)
var code int
var accessErr = new(sdkstatus.ObjectAccessDenied)

switch {
case errors.As(err, &internalErr):
case errors.Is(err, sdkstatus.ErrServerInternal):
code = internal
case errors.As(err, &accessErr):
code = aclDenied
Expand Down

0 comments on commit 6cedb25

Please sign in to comment.