Skip to main content
Three layers of isolation prevent cascading failures. A crashing chart shows a fallback where the chart was; everything else on the page keeps working. This is mandatory, and it is the practical expression of the N5 covenant — failure in one part never breaks the whole.

1. ErrorBoundary

The basic boundary, for a small unit such as a component preview.

2. SectionErrorBoundary

The workhorse. Every page section in the five-layer architecture gets one. It shows the section name, offers a retry, and logs through the observability library without any wiring on your part.

Props

The section string is doing two jobs: it names the thing the reader lost, and it is the handle you grep for when the log shows up. Make it the name a person would use.

3. Route and global boundaries

Next.js provides both. The route boundary (app/error.tsx) catches errors within a route segment and offers a retry. The global boundary (app/global-error.tsx) is the last resort — it wraps the whole document, and it uses hardcoded colours because CSS custom properties may not have loaded by the time it renders. That hardcoded-colour exception is the one place the “no raw hex outside N1” rule is deliberately broken, and the reason is the same reason the boundary exists: it has to render when the rest of the system has not.

Install

section-error-boundary is an N5 resilience component; it lives at components/registry/n5-resilience/ in the registry repository.

What gets logged

The boundary logs through the observability library automatically:
No integration step — wrapping the section is the integration. See observability.