An error page is shown when the react rendering tree throw an error in production
A blank page is shown when the react rendering tree throw an error in production
I'm not 100% sure, but I think that such logic was present with v3.
It could have been removed with https://github.com/zeit/next.js/commit/d19cc975f4be6bf1d1ef205950b5749f5e735d78#diff-1858c8296dd2b642c74271609cf701e7L40.
| Tech | Version |
|---------|---------|
| next | v4.0.2 |
| node | v8.1.4 |
| OS | MacOs |
| browser | Chrome |
+1
At least, I'm pretty happy with the new error mechanism of react@16: componentDidCatch. I do no longer have to hook into react internals to report exceptions to our log service.
@oliviertassinari Hi, do you know if componentDidCatch is supposed to work on the server? It works fine for me on the client, but if I refresh the page where there is an error, triggering server side rendering, the app comes back with a Next.js 500 instead of catching it and displaying my custom message. It kind of defeats the purpose of error boundaries :-/
Nevermind, found my answer: https://github.com/facebook/react/issues/10442
No componentDidCatch for SSR for now :(
@damusnet I didn't know about it. I need to give it as second look!
Unfortunately there are no simple way to catch exception during SSR and our pages can be easily stuck at loading forever.
@ex3ndr actually there are. I coded simple component https://github.com/zekchan/react-ssr-error-boundary
Most helpful comment
Unfortunately there are no simple way to catch exception during SSR and our pages can be easily stuck at loading forever.