Error boundaries per domain
Wrap each domain's UI in an error boundary — one widget crash must not blank the whole shell.
nestjs-resilience-error-boundaries-per-domain
Why it matters
| Stake | If ignored |
|---|---|
| Spreads failure |
|
How to fix
A crash in one domain does not take down the app. Each domain wraps itself in an Error Boundary that knows how to display failure sensibly for that domain.
Examples
tsx
function App() {
return (
<div>
<Sidebar />
<CatalogPanel />
<WorkspacePanel /> {/* throws → whole app blank */}
<AccountPanel />
</div>
);
}tsx
function App() {
return (
<div>
<Sidebar />
<DomainBoundary domain="catalog"> <CatalogPanel /> </DomainBoundary>
<DomainBoundary domain="workspace"> <WorkspacePanel /> </DomainBoundary>
<DomainBoundary domain="account"> <AccountPanel /> </DomainBoundary>
</div>
);
}
function DomainBoundary({ domain, children }: { domain: string; children: ReactNode }) {
return (
<ErrorBoundary
fallback={<DomainErrorFallback domain={domain} />}
onError={(e) => telemetry.captureError(e, { domain })}
>
{children}
</ErrorBoundary>
);
}