diff --git a/pkg/eosclient/eosbinary/eosbinary.go b/pkg/eosclient/eosbinary/eosbinary.go index 72e1fe2a658..9c3a7bf5719 100644 --- a/pkg/eosclient/eosbinary/eosbinary.go +++ b/pkg/eosclient/eosbinary/eosbinary.go @@ -203,6 +203,11 @@ func (c *Client) executeXRDCopy(ctx context.Context, cmdArgs []string) (string, err = errtypes.InvalidCredentials("eosclient: no sufficient permissions for the operation") } + // check for lock mismatch error + if strings.Contains(errBuf.String(), "file has a valid extended attribute lock") { + err = errtypes.BadRequest("eosclient: lock mismatch") + } + args := fmt.Sprintf("%s", cmd.Args) env := fmt.Sprintf("%s", cmd.Env) log.Info().Str("args", args).Str("env", env).Int("exit", exitStatus).Msg("eos cmd") diff --git a/pkg/eosclient/eosgrpc/eoshttp.go b/pkg/eosclient/eosgrpc/eoshttp.go index b78312d634e..722dc88222b 100644 --- a/pkg/eosclient/eosgrpc/eoshttp.go +++ b/pkg/eosclient/eosgrpc/eoshttp.go @@ -210,8 +210,8 @@ func (c *EOSHTTPClient) doReq(req *http.Request, remoteuser string) (*http.Respo return resp, err } -// If the error is not nil, take that -// If there is an error coming from EOS, erturn a descriptive error. +// If the error is not nil, take that. +// If there is an error coming from EOS, return a descriptive error. func (c *EOSHTTPClient) getRespError(rsp *http.Response, err error) error { if err != nil { return err @@ -228,6 +228,8 @@ func (c *EOSHTTPClient) getRespError(rsp *http.Response, err error) error { return errtypes.PermissionDenied(rspdesc(rsp)) case http.StatusNotFound: return errtypes.NotFound(rspdesc(rsp)) + case http.StatusBadRequest: + return errtypes.BadRequest(rspdesc(rsp)) } return errtypes.InternalError("Err from EOS: " + rspdesc(rsp))