Allow SSR Errors to be handled by server/entrypoint
What problem does this feature solve?
The default behaviour when throwing errors seems to be to log it, and continue.
e.g.
This makes it almost impossible to render a nice error page with a proper status code when an error is encountered in SSR. There are also many instances in which we'd want to render an error page in client too.
It would be great if we could choose to abort rendering as soon as an error is encountered, and handle the error in our entrypoint file, or in express.js. Or if we could have a canonical way of rendering error pages.
What does the proposed API look like?
Either
- allow hooks such as created and serverPrefetch to trigger errorCaptured and abort rendering the component, or
- allow adding a property to errors, which would prevent them being caught, and allow them to bubble up to whatever method called renderToString
@edison1105 @yyx990803 Thanks. This still leaves serverPrefetch no bubbling up errors though?
Is there a reason for this?