Skip to content

Conversation

@simeonlee
Copy link
Member

@simeonlee simeonlee commented Jan 8, 2026

Summary

  • Adds ErrorBoundary to top-level layouts (8 layouts)
  • Removes redundant route-level error boundaries (~700 lines deleted)
  • Routes without layouts keep simplified ErrorBoundary using RouteErrorContent

Result: All page errors show light card (less scary), infra errors show dark modal (PR #5549).

Part of error boundary PR stack:

  1. Error boundaries with graceful degradation for infrastructure errors #5549 - Global error boundary with dismissible modal (base)
  2. This PR - Layout-level error handling consolidation

Rationale

Why layout-level instead of route-level?

Without this PR, errors would be caught by the root boundary and show a dark modal for everything. With layout-level boundaries:

Error Type User Experience
Page errors (API failures, bad data) Light card, sidebar visible, can navigate away
Infra errors (gateway down, auth) Dark modal, dismissible (from PR #5549)

The layout boundary intercepts page errors before they reach root, enabling the better UX.

Why not keep route-level boundaries?

  • 90% of routes had identical error handling code
  • Layout boundaries catch errors from all child routes
  • Reduces ~700 lines of duplicate code
  • Routes without layouts keep their boundaries (e.g., /playground)

Approach

Route Type Error Handling
Routes WITH layouts Layout ErrorBoundary → RouteErrorContent (light card)
Routes WITHOUT layouts Route ErrorBoundary → RouteErrorContent (light card)
Infra errors (gateway, auth, DB) Root ErrorBoundary → ErrorDialog (dark modal)

Layouts Covered

Top-level layouts with ErrorBoundary added:

  • datasets/layout.tsx
  • datapoints/layout.tsx
  • evaluations/layout.tsx
  • workflow_evaluations/layout.tsx
  • autopilot/layout.tsx
  • observability/functions/layout.tsx
  • observability/inferences/layout.tsx
  • observability/episodes/layout.tsx

Local Testing

Create uncommitted debug routes:

Route Tests Expected
/_debug/error-page Layout ErrorBoundary Light card
/_debug/error-infra Root ErrorBoundary Dark modal

Status

🚧 Work in progress - not ready for review

Test plan

  • Verify errors in routes with layouts are caught by layout ErrorBoundary
  • Verify errors in routes without layouts show RouteErrorContent
  • Confirm sidebar remains visible on all page errors
  • Verify infra errors still show dark modal

@simeonlee simeonlee changed the title [WIP] Add layout-level error boundaries [WIP] Consolidate error handling at layout level Jan 8, 2026
@simeonlee simeonlee force-pushed the simeonlee/global-error-boundary branch from 7d95d7a to e0fe1c5 Compare January 8, 2026 17:32
@simeonlee simeonlee force-pushed the simeonlee/route-error-boundaries branch 2 times, most recently from ecee654 to 9fd23fd Compare January 8, 2026 17:50
Each top-level layout now has an ErrorBoundary that catches errors
from child routes and displays them using RouteErrorContent.

This provides consistent error handling at the page level while
keeping the sidebar visible.
Now that layouts have ErrorBoundary, individual routes no longer need
their own error handling. Errors bubble up to the nearest layout.

Removes ~700 lines of duplicated error handling code.
@simeonlee simeonlee force-pushed the simeonlee/route-error-boundaries branch from 9fd23fd to f6def3e Compare January 8, 2026 17:56
- Add vertical-stacking SimpleErrorDisplay for header-only errors
- Use FileQuestion icon with muted styling for 404s
@simeonlee simeonlee force-pushed the simeonlee/route-error-boundaries branch from a8e1d5f to 2f5b49f Compare January 8, 2026 18:09
@simeonlee simeonlee merged commit 90f7d7c into simeonlee/global-error-boundary Jan 8, 2026
46 of 51 checks passed
@simeonlee simeonlee deleted the simeonlee/route-error-boundaries branch January 8, 2026 23:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants