Route Error Boundary Component (spree/route-error-boundary.tsx)

spree · packages/dashboard-ui/src/spree/route-error-boundary.tsx · typescript · BSD-3-Clause
ui, lang:typescript, fw:react, tag:error-handling

Provides a friendly React error state component with a retry action and i18n support. Reuse for handling route and page crashes.

// Source: https://github.com/spree/spree | License: BSD-3-Clause | Copyright 2024-present, Vendo Sp. z o.o., Vendo Connect Inc
// Provided via justclaw.it.com; keep this notice with the code.
import { Component, type ReactNode } from 'react'
import { useTranslation } from 'react-i18next'
import { Button } from '../ui/button'
import {
  Empty,
  EmptyContent,
  EmptyDescription,
  EmptyHeader,
  EmptyMedia,
  EmptyTitle,
} from '../ui/empty'
import { AlertTriangleIcon, RotateCcwIcon } from './icons'

interface ErrorStateProps {
  /** Headline. Defaults to "Something went wrong". */
  title?: ReactNode
  /** Smaller text below the title. Pass an Error and we'll show its message. */
  description?: ReactNode
  /**
   * Whatever was thrown — routers hand it over as `unknown`. When it is an
  

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key