Next.js Discord

Discord Forum

Unhandled error caught in parent error.js/tsx file and not in sibling error.js/tsx file

Unanswered
Donskoy posted this in #help-forum
Open in Discord
DonskoyOP
Based on the official docs (https://nextjs.org/docs/app/building-your-application/routing/error-handling#nested-routes) I understood that error.js/tsx file also covers the page.js/tsx file within the same folder, but not the layout.js/tsx. Hoverer, in practice, adding an error.js/tsx file in the same folder with page.js/tsx did not catch any errors within that page.js/tsx file, but rather I had to add error.js/tsx file in the parent directory, in order to catch errors in the nested page.js/tsx. Can someone confirm that the docs are indeed incorrect?

0 Replies