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 8, 2023
1 parent a6bcf16 commit 0bf3829
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Changelog for NeoFS Node
- Session inactivity on object PUT request relay (#2460)
- Missing connection retries on IR node startup when the first configured mainnet RPC node is not in sync (#2474)
- Storage node no longer ignores unhealthy shards on startup (#2464)
- Processing of status errors returned by API client from NeoFS SDK RC-9 (#2465)

### Removed
- Deprecated `morph.rpc_endpoint` SN and `morph.endpoint.client` IR config sections (#2400)
Expand Down
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 0bf3829

Please sign in to comment.