Error Boundary Kit
Production-ready error boundaries for Vue 3 — a declarative <ErrorBoundary> component, a useErrorBoundary() composable for programmatic use, and an adapter-based reporting layer (Sentry / Bugsnag / LogRocket / plain HTTP) that isn't hard-baked into the core.
Zero runtime dependencies beyond Vue itself. Core bundle (<ErrorBoundary> + useErrorBoundary) is ~2.1 kB gzip; every reporting adapter is its own entry point and only ships if you import it.
Features
<ErrorBoundary>— declarative component with afallbackslot, retry, reset, andresetKeys-driven auto-reset<AsyncBoundary>— combines<Suspense>and<ErrorBoundary>in one component, adding aloadingslot; separate entry point, costs nothing unless importeduseErrorBoundary()— programmatic use outside a template boundary, with an explicitcaptureError()useGlobalErrorCapture()— opt-in separate entry point for whaterrorCapturedstructurally cannot see: raw event-listener callbacks, timers, unhandled promise rejections- Retry with backoff —
vue-error-boundary-kit/retry-backoffwraps a boundary'sretry()with an increasing delay for transient/network failures - Reporting adapters — six ready-made adapters (console, HTTP, Sentry, Bugsnag, LogRocket, OpenTelemetry), each its own entry point that only ships if imported
- Rate-limiting & dedup —
adapters/rate-limitwraps any reporter(s) to cap and deduplicate reports during a mass-failure storm - Breadcrumbs — a rolling window of "things that happened before the error", attached to reports automatically once wired in
- Nested boundaries —
isolate: falselets a locally-handled error also bubble to the nearest ancestor boundary; a reporter is guaranteed to fire exactly once even across the chain shouldCatch— let specific errors (e.g. a cancelled fetch'sAbortError) pass through a boundary completely untouched- Nuxt module —
vue-error-boundary-kit/nuxtauto-registers<ErrorBoundary>and auto-imports the composables;useNuxtErrorBoundary()also catches Nuxt's ownvue:error/app:errorhooks - Vue Router integration —
useRouterErrorBoundary()catches errorsonErrorCapturedstructurally never sees: navigation guards,next(), async route components - TanStack Query integration —
useQueryErrorReset()resets errored queries before a retry, so a retried query actually refetches instead of instantly failing again - Debug error history — the dependency-free
/devtoolsentry point'screateErrorHistory()+<ErrorHistoryPanel>, roughly 9× lighter than a real Vue Devtools integration - Testing utilities —
/testingentry point with throw-fixtures and a recording reporter test double, framework-agnostic beyond Vue itself - SSR-safe — a failing subtree never crashes
renderToString; error events and reporters fire correctly on the server; hydration always converges on correct client content - Zero runtime dependencies beyond Vue — every feature past the core boundary is its own tree-shakeable entry point
The problem
React has had error boundaries as a first-class pattern for years. Vue 3 only gives you the low-level onErrorCaptured hook — every project ends up re-inventing a fallback-UI component with retry and error reporting around it. This package is that component, done once, with:
- a declarative
<ErrorBoundary>with afallbackslot and retry; useErrorBoundary()for programmatic use outside a template boundary;- a single adapter-based error-reporting mechanism (Sentry / Bugsnag / custom
fetch— no hard dependency); useGlobalErrorCapture(), an opt-in separate entry point for whaterrorCapturedstructurally cannot see (raw event-listener callbacks, timers, unhandled promise rejections).