Skip to content

Implement global error boundary with automatic Sentry reporting and user-facing recovery UI #42

Description

@prodbycorne

Problem

src/components/ErrorBoundary exists as a directory but the component inside it is not wired into the App Router layout. If an unhandled error occurs (e.g. a corrupted ScVal crashes the XDR parser mid-render), the entire page goes blank in production with no user-facing explanation and no automatic error report.

Expected Behaviour

The global error boundary catches render errors anywhere in the tree, shows a branded recovery screen with a Try Again button that triggers reset(), and optionally reports the error to Sentry (or another error tracker) using NEXT_PUBLIC_SENTRY_DSN.

Acceptance Criteria

  • src/app/error.tsx created (the Next.js App Router error boundary convention) with 'use client' directive, error prop, and reset prop
  • The component renders the SmartDrop logo, the message "Something went wrong", a tidy error code derived from error.digest, a Try Again button (onClick={reset}), and a Go Home link
  • If NEXT_PUBLIC_SENTRY_DSN is set in the environment, @sentry/nextjs is initialised and Sentry.captureException(error) is called inside a useEffect in the error boundary
  • src/app/global-error.tsx handles root layout crashes (Chakra provider itself crashing) — it renders a minimal plain-HTML recovery page that does not depend on Chakra
  • The existing src/components/ErrorBoundary class component is audited — if it is already used as a per-route boundary, its onError callback is wired to Sentry as well
  • A Playwright test navigates to /farm, injects a render error via page.evaluate, and asserts the "Something went wrong" recovery screen appears and the Try Again button re-renders the farm page

Relevant Files

  • src/app/error.tsx — create (Next.js App Router convention)
  • src/app/global-error.tsx — create
  • src/components/ErrorBoundary/ — audit and wire to Sentry
  • next.config.ts — Sentry webpack plugin (optional, behind env flag)

Metadata

Metadata

Labels

Official CampaignCampaign: Official CampaignhardRequires deep domain knowledge — Soroban, Stellar SDK, or complex stateuxUser experience, interaction design, loading states

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions