Skip to content

components/bits/SilentErrorBoundary#

SilentErrorBoundary#

Catches errors in a non-critical widget so it cannot take the app down.

"Silent" refers to the app, not the user: the widget used to render null, so a crashed status-bar item simply vanished and the missing readout looked like a missing feature. It now leaves a small marker whose tooltip names the component and the error, which is the difference between "this is broken" and "this was never here".

Extends#

  • Component<Props, State>

Constructors#

Constructor#

new SilentErrorBoundary(props): SilentErrorBoundary;
Parameters#
Parameter Type
props Props
Returns#

SilentErrorBoundary

Overrides#
Component<Props, State>.constructor

Methods#

componentDidCatch()#

componentDidCatch(error, errorInfo): void;

Catches exceptions generated in descendant components. Unhandled exceptions will cause the entire component tree to unmount.

Parameters#
Parameter Type
error Error
errorInfo ErrorInfo
Returns#

void

Overrides#
Component.componentDidCatch

getDerivedStateFromError()#

static getDerivedStateFromError(error): Partial<State>;
Parameters#
Parameter Type
error Error
Returns#

Partial<State>

render()#

render(): 
  | string
  | number
  | boolean
  | Element
  | Iterable<ReactNode, any, any>;
Returns#

| string | number | boolean | Element | Iterable<ReactNode, any, any>

Overrides#
Component.render