ERROR_HANDLING.md
This document describes the error handling improvements made to Chatbox to address the issue where some users experienced "something went wrong!" errors with "cannot read properties of undefined" that were not being reported to Sentry.
src/renderer/components/ErrorBoundary.tsx)Created a comprehensive React Error Boundary component that:
src/renderer/setup/global_error_handler.ts)Added global error handlers for:
Updated the main application files:
src/renderer/index.tsx: Wrapped both initialization and main app with ErrorBoundarysrc/renderer/routes/__root.tsx: Added error boundary at the route levelsrc/renderer/utils/error-testing.ts)Created testing utilities for development mode:
window.errorTestingUtils in developmentThe solution implements a multi-layered error catching approach:
In development mode, you can test error handling using:
// Test React error boundary
window.errorTestingUtils.triggerReactError()
// Test global error handler
window.errorTestingUtils.triggerGlobalError()
// Test unhandled promise rejection
window.errorTestingUtils.triggerUnhandledRejection()
// Test property access error
window.errorTestingUtils.triggerPropertyError()
// Test Sentry integration
window.errorTestingUtils.testSentryCapture()
// Test console error interception
window.errorTestingUtils.triggerConsoleError()
When errors occur, users will see:
All caught errors are reported to Sentry with:
This ensures that developers can identify and fix issues that users encounter in production.