Next.js Discord

Discord Forum

How to handle only certain errors in error.tsx?

Alaska pollock posted this in #help-forum
Open in Discord
Alaska pollockOP
Hi! I'm currently implementing error handling in our application. I would like to catch all errors in my error.tsx file, however if we are in production I want to rely on the CDN default error pages. Which means that in production, I want to throw notFound() for example and not handle it in my error.tsx file. Since the error.tsx expects JSX to be returned I cannot throw notFound here

0 Replies