Skip to content

Commit

Permalink
fix: improve error messaging for http hooks (#1821)
Browse files Browse the repository at this point in the history
## What kind of change does this PR introduce?
* HTTP hooks that return status codes outside of the accepted status
codes will cause Auth to return an obscure error message that is hard to
debug: `Error executing Hook` - this change is an attempt to improve the
error messaging to reflect the status code being rejected

## What is the current behavior?

Please link any relevant issues here.

## What is the new behavior?

Feel free to include screenshots if it includes visual changes.

## Additional context

Add any other context or screenshots.
  • Loading branch information
kangmingtay authored Oct 28, 2024
1 parent 3b03472 commit fa020d0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion internal/api/hooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ func (a *API) runHTTPHook(r *http.Request, hookConfig conf.ExtensibilityPointCon
case http.StatusUnauthorized:
return nil, internalServerError("Hook requires authorization token")
default:
return nil, internalServerError("Error executing Hook")
return nil, internalServerError("Unexpected status code returned from hook: %d", rsp.StatusCode)
}
}
return nil, nil
Expand Down

0 comments on commit fa020d0

Please sign in to comment.