-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Closed as not planned
Labels
Description
Describe the problem
I have business logic that throws well-formed errors with HTTP status codes. The errors are shared between several applications (API, web front-end, etc.).
Currently, it seems like if the code is dropping down to the HandleServerError hook, it always returns a 500 if the status wasn't defined before it was triggered, and there's no way to change the status while in the hook.
Describe the proposed solution
I would like to be able to set the response status inside the hook:
export const handleError: HandleServerError = ({ error, event, status }) => {
status(404);(or via some other way)
Alternatives considered
Alternative to this seems to be to write my own wrapper and call the business logic through it, rethrowing error(status, message) which seems inelegant.
Importance
would make my life easier
Additional Information
No response