SolidJSS
SolidJS2y ago
9 replies
jp

error handling with lazy

I have a simple SSR setup similar to https://github.com/bluwy/create-vite-extra/tree/master/template-ssr-solid. When lazy loading a route's component that has an error such as Invalid JSX: <div> cannot be child of <p>, the dev server crashes due to an unhandled exception, whereas I would expect the ErrorBoundary to catch it or at least be able to catch it when awaiting renderToStringAsync. Checking the source for lazy, I don't see a catch block when evaluating the promise: https://github.com/solidjs/solid/blob/main/packages/solid/src/server/rendering.ts#L470, so it seems the assumption is that lazy loading failures are considered fatal. Perhaps there is another way I'm missing to handle this error?
GitHub
A declarative, efficient, and flexible JavaScript library for building user interfaces. - solidjs/solid
solid/packages/solid/src/server/rendering.ts at main · solidjs/solid
Was this page helpful?