Catch errors at runtime

Jeasx streams markup by default. Errors that happen before the first chunk is sent are handled by Fastify's error handler, which answers with the right status code. By default, it responds with JSON; register your own via setErrorHandler() in FASTIFY_SERVER of jeasx.config.js to render a user-friendly error page.

Once streaming has started, status and headers are already sent: wrap risky components in an error boundary to render a fallback instead. Pick a scenario below and have a look at the source to see how things are wired up.

Error before streaming

The route throws before it returns any markup. Nothing is sent yet, so Fastify's error handler answers with status 500.

Try it→ Fastify's error handler
Error while streaming, caught

A component fails after the page has started streaming. An error boundary catches it and renders a fallback instead.

Error while streaming, uncaught

The same component without a boundary. Status and headers are already sent, so the page simply ends where the error happened.