Proper error handling in Next.js 15 is spread across four different mechanisms that serve different purposes. Most guides cover one of them. This covers all four — and how they work together in a production app.
The Four Layers of Error Handling
error.tsx — Client component that catches rendering errors in a route segment
global-error.tsx — Catches errors in the root layout itself
Server action errors — Errors that happen during mutations and form submissions






