MENU
error.js
The special file error.js is used in place of page.js, when a runtime error occurs.
The nearest ancestor error.tsx file in the route hierarchy is used.
error.js boundaries catch errors thrown in page.js of the same segment, but do not catch errors thrown in layout.js or template.js components of the same segment.
To handle errors within the root layout or template, use global-error.js instead.