Skip to content

Commit

Permalink
already unwrapped in error handler
Browse files Browse the repository at this point in the history
  • Loading branch information
ozkatz committed May 20, 2024
1 parent 4f02eb6 commit 2aea483
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions pkg/api/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -2651,7 +2651,7 @@ func (c *Controller) handleAPIErrorCallback(ctx context.Context, w http.Response
var hookAbortErr *graveler.HookAbortError
if errors.As(err, &hookAbortErr) {
log.WithField("run_id", hookAbortErr.RunID).Warn("aborted by hooks")
cb(w, r, http.StatusPreconditionFailed, err)
cb(w, r, http.StatusPreconditionFailed, hookAbortErr.Unwrap())
return true
}

Expand Down Expand Up @@ -4637,14 +4637,11 @@ func (c *Controller) MergeIntoBranch(w http.ResponseWriter, r *http.Request, bod
swag.StringValue(body.Strategy),
graveler.WithForce(swag.BoolValue(body.Force)))

var v *graveler.HookAbortError
if errors.Is(err, graveler.ErrConflictFound) {
writeResponse(w, r, http.StatusConflict, apigen.MergeResult{
Reference: reference,
})
return
} else if errors.As(err, &v) {
err = v.Unwrap()
}
if c.handleAPIError(ctx, w, r, err) {
return
Expand Down

0 comments on commit 2aea483

Please sign in to comment.