@molecule/app-root-error-boundary-vue

Feature · error-boundary · App (browser) · v1.1.1 · Apache-2.0

Top-level Vue error boundary that logs render errors via the bonded app logger and shows a minimal recovery surface

npm install @molecule/app-root-error-boundary-vue

npm · Source on GitHub

How it works

@molecule/app-root-error-boundary-vue is a ready-made error-boundary feature for the app (browser) side. It composes the core interfaces it needs, so it works with whichever providers your app has bonded.

import { createApp, h } from 'vue'

import { RootErrorBoundary } from '@molecule/app-root-error-boundary-vue'

const app = createApp({
  render: () => h(RootErrorBoundary, null, () => [h('router-view')]),
})
app.mount('#app')

Works with: @molecule/app-i18n, @molecule/app-logger, @molecule/app-ui, @molecule/app-ui-vue, @molecule/app-vue

Reference

Vue top-level error boundary — the counterpart of @molecule/app-root-error-boundary-react: the same props and the same DOM for the same input.

Exports <RootErrorBoundary> (children is the only prop, also accepted as the default slot). Mount it directly under your routing root so it covers the whole route tree.

Auto-generated, AI-first package reference for the molecule.dev ecosystem. It is written to be read by coding agents as much as by people, and is generated from this package's source — edit src/index.ts JSDoc, not this file.

Quick Start

import { createApp, h } from 'vue'

import { RootErrorBoundary } from '@molecule/app-root-error-boundary-vue'

const app = createApp({
  render: () => h(RootErrorBoundary, null, () => [h('router-view')]),
})
app.mount('#app')

Type

feature

Installation

npm install @molecule/app-root-error-boundary-vue @molecule/app-i18n @molecule/app-logger @molecule/app-ui @molecule/app-ui-vue @molecule/app-vue vue

API

Constants

RootErrorBoundary

RootErrorBoundary component.

Top-level error boundary that catches descendant render errors, logs them via the bonded @molecule/app-logger, and falls back to a minimal localized recovery surface read through useTranslation() from @molecule/app-vue. Renders its children untouched while no error has been caught — there is no wrapper element, matching React's fragment root.

This is the Vue counterpart of @molecule/app-root-error-boundary-react.

const RootErrorBoundary: DefineComponent<
  ExtractPropTypes<{ children: null }>,
  () =>
    | VNode<RendererNode, RendererElement, { [key: string]: any }>
    | (
        | string
        | number
        | boolean
        | VNode<RendererNode, RendererElement, { [key: string]: any }>
        | VNodeArrayChildren
      )[],
  {},
  {},
  {},
  ComponentOptionsMixin,
  ComponentOptionsMixin,
  {},
  string,
  PublicProps,
  Readonly<ExtractPropTypes<{ children: null }>> & Readonly<{}>,
  {},
  {},
  {},
  {},
  string,
  ComponentProvideOptions,
  true,
  {},
  any
>

Injection Notes

Requirements

Peer dependencies:

  • @molecule/app-i18n ^1.0.1
  • @molecule/app-logger ^1.0.1
  • @molecule/app-ui ^1.0.1
  • @molecule/app-ui-vue ^1.1.0
  • @molecule/app-vue ^3.5.0 || ^4.0.0
  • vue ^3.4.0

Runtime Dependencies

  • @molecule/app-i18n

  • @molecule/app-logger

  • @molecule/app-ui

  • @molecule/app-ui-vue

  • @molecule/app-vue

  • vue

  • The fallback UI styles itself via getClassMap() — if no ClassMap is bonded the boundary itself throws while rendering the fallback. Ensure setClassMap() runs during bootstrap, before anything can error.

  • There is no retry/reload action — the fallback is a static message (key error.unknown). Wrap or fork when you need a recovery button.

  • The boundary catches RENDER errors only — not event handlers, async code, or server-side rendering errors.

  • The fallback translates through useTranslation(), so it re-renders in the new language after a locale switch. No i18n plugin is required: outside one it reads the bonded @molecule/app-i18n provider, and without locale registration it falls back to English. Translations: @molecule/app-locales-root-error-boundary.

Translations

Translation strings are provided by @molecule/app-locales-root-error-boundary.