feat: detailed error page for crashes#439
Conversation
- Dev mode: show error details - Prod mode: show generic error message
📝 WalkthroughWalkthroughAdds a new ChangesError Boundary
Estimated code review effort: 2 (Simple) | ~10 minutes Sequence Diagram(s)sequenceDiagram
participant App
participant ErrorBoundary
participant ReactRuntime
App->>ErrorBoundary: render children
ReactRuntime-->>ErrorBoundary: error thrown during render
ErrorBoundary->>ErrorBoundary: getDerivedStateFromError(error)
ErrorBoundary->>ErrorBoundary: componentDidCatch(error, info)
ErrorBoundary->>ErrorBoundary: render fallback UI (dev or prod)
ErrorBoundary-->>App: reset() clears error state
Related issues: None specified. Related PRs: None specified. Suggested labels: frontend, enhancement Suggested reviewers: None specified. Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
frontend/src/components/ErrorBoundary.jsx (1)
13-15: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick winNo error reporting/telemetry on catch.
componentDidCatchonly stores the component stack locally; nothing is sent to a monitoring/logging service. In production the user only sees a generic message, so without reporting here, crashes go unnoticed by the team.♻️ Suggested addition
componentDidCatch(error, info) { this.setState({ componentStack: info.componentStack }); + // e.g. reportError(error, info.componentStack); }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@frontend/src/components/ErrorBoundary.jsx` around lines 13 - 15, The ErrorBoundary component currently only saves the component stack in componentDidCatch and does not report the caught error anywhere. Update componentDidCatch in ErrorBoundary.jsx to send the error and its stack/info to the existing telemetry or logging service used by the app, while keeping the local setState({ componentStack: info.componentStack }) behavior. Use the componentDidCatch method and ErrorBoundary class as the integration point, and make sure the report happens whenever a render crash is caught in production.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@frontend/src/components/ErrorBoundary.jsx`:
- Line 29: The ErrorBoundary heading text contains a stray trailing backslash in
the "Something went wrong :\\" string, which renders as an artifact. Update the
message in ErrorBoundary.jsx to use the intended sad-face text, and verify the
JSX heading displays the corrected emoticon consistently.
---
Nitpick comments:
In `@frontend/src/components/ErrorBoundary.jsx`:
- Around line 13-15: The ErrorBoundary component currently only saves the
component stack in componentDidCatch and does not report the caught error
anywhere. Update componentDidCatch in ErrorBoundary.jsx to send the error and
its stack/info to the existing telemetry or logging service used by the app,
while keeping the local setState({ componentStack: info.componentStack })
behavior. Use the componentDidCatch method and ErrorBoundary class as the
integration point, and make sure the report happens whenever a render crash is
caught in production.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: a8bc321a-3e93-45d1-922e-6c376cf54ce8
📒 Files selected for processing (2)
frontend/src/App.jsxfrontend/src/components/ErrorBoundary.jsx
Issue
App crashes fall back to a blank page with no information
Solution
Risk
Low
Checklist
Summary by CodeRabbit