Using NextJS, I see 2 kinds of errors:
Server Error
- generated it using
throw new Error(...)
inside getInitialProps... - it can occur due to some business logic or unexpected API response;
- screenshot:
Unhandled Runtime Error
- generated it using
throw new Error(...)
inside a component - it can occur due to some business logic;
- the error here is captured by the ErrorBoundary (which is set inside
_app.js
) - screenshot:
Question: unhandled run time errors are captured inside Error Boundary (as they do in ReactJS)... how to best handle the 'server errors'... what is the best practice?