Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

Proper error handling for server routes instead of sending all errors as a text response #812

Open
racbart opened this issue Jul 20, 2019 · 2 comments

Comments

@racbart
Copy link

racbart commented Jul 20, 2019

Is your feature request related to a problem? Please describe.

All errors originating in server routes are currently sent as a text response by Sapper and there is no way to prevent this. This might cause to leak some information which should not happen on production. It also requires somehow boilerplate-ish code in every server route if you need to either log the error or to format it in some other way (e.g. formulating a JSON response).

Describe the solution you'd like

An option to provide a function to handle server route errors in a centralised way.

Describe alternatives you've considered

Injecting express/polka middleware before or after Sapper's cannot solve this problem, because Sapper handles server routing internally in its middleware, catches and handles all errors inside.

How important is this feature to you?

I believe it's critical for any real-world production deployment to be able to control what happens with errors. You usually need to log them and you need to control the output sent to the browser. At least, it is critical to me.

Additional context

I created a patch for this and will submit a pull request in a moment.

@zolotokrylin
Copy link

This functionality is very much needed!

@sdwvit
Copy link

sdwvit commented Aug 3, 2020

please fix this, it's very hard to debug

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
5 participants