configureClientErrors
Registers the ambient client error hook: called once per error object when an error boundary renders its fallback, with where the error was thrown and where it was met.
Import
import { configureClientErrors } from "solid-js";Type signature
function configureClientErrors(config: ClientErrorsConfig): void;Parameters
config
- Type:
ClientErrorsConfig
Learn more
Related types
ClientErrorContext
The client error hook — the prod-tier seam through which an app or an
error monitor hears the one failure nothing else can see: an error
boundary (createErrorBoundary, <Errored>) collected it and is rendering
its fallback. The browser's global handlers hear what reaches
window.onerror; a rendered fallback never does. An UNCAUGHT error is not
this hook's: the halt (REACTIVITY_HALTED) hands its cause to the
platform's reportError, the channel every monitor already listens on —
one event, not two.
Called once per error object: a boundary's reset() recomputing the same
failing node re-collects the same error and does not report it again.
Two tiers: ambient (configureClientErrors) and per root
(render/hydrate's onError in @solidjs/web), the nearest root's
winning. Fires in every tier; no return — the client has no wire to map
for. ownerPath carries the component labels where the runtime keeps
owner names (the observe and dev artifacts).
Pay-for-use: this module is retained by createErrorBoundary (which
reports here) or the app's own configureClientErrors import. A root's
hook is parked ON the root owner under a registered symbol
(ROOT_ERROR_HOOK, defined in the scheduler), so render writes it
without importing anything: an app that configures no hook and renders no
boundary carries none of this.
interface ClientErrorContext { ownerPath?: string[]; boundaryPath?: string[];}ownerPath
- Type:
string[]
Where the error was THROWN: labels root-first up the owner chain of the computation that threw — component labels and named primitives — when the runtime keeps owner names (the observe and dev artifacts). The boundary's own chain when the thrower is unknown (a value thrown outside any computation).
boundaryPath
- Type:
string[]
Where the error was MET: the same labels up the chain of the <Errored>
that rendered its fallback for it — what the user saw, as against
ownerPath, which is what broke.
ClientErrorHook
type ClientErrorHook = (error: unknown, context: ClientErrorContext) => void;ClientErrorsConfig
interface ClientErrorsConfig { onError?: ClientErrorHook;}onError
- Type:
ClientErrorHook
The hook, or undefined to clear it.