kit
kit copied to clipboard
Allow redirects from handleError server hook
Describe the problem
Currently, I'm throwing an "unexpected" error so that I can get access to the event object to add information, returning an error object with a flag, and then redirecting when it gets back to the layout if it contains the flag. The error is an auth error in a generic request wrapper so it gets used in lots of places that would make passing in event or page information difficult.
Describe the proposed solution
Allow for redirecting from the handleError server hook so that there doesn't need to be an extra return trip.
Alternatives considered
Adding a hook for expected errors. This way I could throw the redirect whenever but still have access to a hook point where I could transform the redirect (e.g. adding in return info).
Importance
would make my life easier
Additional Information
No response