Under The Hood
frontend solidjs SolidJS 1.x / 2.x

<ErrorBoundary>: Reactive Owner Scope Error Capture and Fallback Swaps

Last updated
Prerequisites:
SolidJS Owner Hierarchy
SolidJS Components Run Once
  • solidjs
  • error-boundary
  • errors
  • owner-tree
  • catchError
  • reactivity

Read at your depth

The practical view

`<ErrorBoundary fallback={(err, reset) => <ErrorUI error={err} retry={reset} />}>` is a built-in Solid component that catches JavaScript errors thrown in its child component hierarchy. When an error occurs in a child computation, render block, or resource, the error boundary catches it, prevents the app from crashing, and renders the fallback function with a `reset()` callback to retry.

The same idea in other frameworks

react equivalent
React Class Component with `componentDidCatch` and `getDerivedStateFromError`.

Legacy vs modern

Uncaught Application Crash vs <ErrorBoundary> Isolation

Uncaught errors in child components break the whole page; `<ErrorBoundary>` isolates failures and offers retry mechanisms.

before → after
Unprotected Component Tree
<BuggyWidget /> // ❌ An error here crashes the entire application view
Solid <ErrorBoundary>
<ErrorBoundary fallback={(err, reset) => <Fallback error={err} onReset={reset} />}><BuggyWidget /></ErrorBoundary> // ✅ NEW

Interview gotchas

Context

Interviewers test your knowledge of how async errors propagate through the reactive graph.

The mechanical answer

Yes. When a `createResource` fetcher promise rejects, the error is stored in `data.error`. When the resource is read inside an `<ErrorBoundary>` under `<Suspense>`, the error is thrown directly to the nearest `catchError` owner, triggering the `<ErrorBoundary fallback={...}>`.

Trap

Errors thrown inside un-tracked detached asynchronous callbacks (like a raw `setTimeout(() => { throw new Error(); })`) cannot be caught by `<ErrorBoundary>` because they execute outside the Owner tracking scope.

Under The Hood — a multi-depth technical interview hub.

Third-party licenses Press ⌘ K to search.