Skip to content

ErrorBoundary

reference
1 min readUpdated

Kind: Constant

Source: src/jsx/dom/components.ts

Part of: Jsx

Definition

ts
FC< PropsWithChildren<{ fallback?: Child fallbackRender?: FallbackRender onError?: ErrorHandler }> >

Value

ts
(({ children, fallback, fallbackRender, onError }: any) => {
  const res = Fragment({ children })
  ;(res as any)[DOM_ERROR_HANDLER] = (err: any) => {
    if (err instanceof Promise) {
      throw err
    }
    onError?.(err)
    return fallbackRender?.(err) || fallback
  }
  return res
}) as any

Relationships

  • IMPORTS → DOM_ERROR_HANDLER

Used by

1 reference from 1 file. Each is a place in this repository where the symbol is actually used — go read one rather than trusting an example.

Imported by (1)

  • childrenToStringsrc/jsx/components.ts:14

Was this page helpful?

Download as PDF
ErrorBoundary — Hono (narrator proof)