diff --git a/changelog/unreleased/fix-eos-grpc-errors.md b/changelog/unreleased/fix-eos-grpc-errors.md new file mode 100644 index 0000000000..61b0d7d77d --- /dev/null +++ b/changelog/unreleased/fix-eos-grpc-errors.md @@ -0,0 +1,5 @@ +Bugfix: fixed error reporting in the EOS gRPC client + +This in particular fixes the lock-related errors + +https://github.com/cs3org/reva/pull/5015 diff --git a/pkg/eosclient/eosgrpc/eosgrpc.go b/pkg/eosclient/eosgrpc/eosgrpc.go index 72c22a4974..20954ddd5c 100644 --- a/pkg/eosclient/eosgrpc/eosgrpc.go +++ b/pkg/eosclient/eosgrpc/eosgrpc.go @@ -216,7 +216,14 @@ func (c *Client) getRespError(rsp *erpc.NSResponse, err error) error { return nil } - return errtypes.InternalError("Err from EOS: " + fmt.Sprintf("%#v", rsp.Error)) + switch rsp.Error.Code { + case 16: // EBUSY + return eosclient.FileIsLockedError + case 17: // EEXIST + return eosclient.AttrAlreadyExistsError + default: + return errtypes.InternalError(fmt.Sprintf("%s (code: %d)", rsp.Error.Msg, rsp.Error.Code)) + } } // Common code to create and initialize a NSRequest.