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

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

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

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

npm · Source on GitHub

How it works

@molecule/app-root-error-boundary-solid 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 { Router } from '@solidjs/router'

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

function AppRoot() {
  return (
    <RootErrorBoundary>
      <Router>…</Router>
    </RootErrorBoundary>
  )
}

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

Reference

Solid 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). 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 { Router } from '@solidjs/router'

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

function AppRoot() {
  return (
    <RootErrorBoundary>
      <Router>…</Router>
    </RootErrorBoundary>
  )
}

Type

feature

Installation

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

API

Functions

RootErrorBoundary(props)

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-solid. Renders its children untouched while no error has been caught — there is no wrapper element, matching React's fragment root.

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

function RootErrorBoundary(props: Props): Accessor<JSX.Element | undefined>
  • props — Component props (see Props).

Returns: The guarded tree, or the recovery alert once an error was caught.

Injection Notes

Requirements

Peer dependencies:

  • @molecule/app-i18n ^1.0.1
  • @molecule/app-logger ^1.0.1
  • @molecule/app-solid ^3.5.0 || ^4.0.0
  • @molecule/app-ui ^1.0.1
  • @molecule/app-ui-solid ^1.1.0
  • solid-js ^1.8.0

Runtime Dependencies

  • @molecule/app-i18n

  • @molecule/app-logger

  • @molecule/app-solid

  • @molecule/app-ui

  • @molecule/app-ui-solid

  • solid-js

  • 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 MoleculeProvider 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.