Skip to content

Comments

refactor: report errors to Bugsnag when using error boundary (ErrorPage fallback)#1696

Merged
morgan-wowk merged 1 commit intomasterfrom
01-26-refactor-error-component-names
Feb 5, 2026
Merged

refactor: report errors to Bugsnag when using error boundary (ErrorPage fallback)#1696
morgan-wowk merged 1 commit intomasterfrom
01-26-refactor-error-component-names

Conversation

@morgan-wowk
Copy link

@morgan-wowk morgan-wowk commented Jan 26, 2026

Description

Note: Some of these changes are in preparation for work that is upstack. We wouldn't normally do this but don't wish to change it at this point.

Enhanced error handling by moving ErrorPage from routes to shared components and adding Bugsnag integration. The component now automatically reports errors to Bugsnag when configured and includes the current pathname as metadata. Added support for error boundary reset functionality, allowing the component to properly reset when used with React error boundaries. Improved error message handling to better display different error types.

Type of Change

  • Bug fix
  • New feature
  • Improvement
  • Cleanup/Refactor
  • Breaking change
  • Documentation update

Checklist

  • I have tested this does not break current pipelines / runs functionality
  • I have tested the changes on staging

Test Instructions

  1. Test the error display by navigating to a non-existent route
  2. Verify that the error message is displayed correctly
  3. Test the "Try Again" and "Go Home" buttons to ensure they work as expected
  4. Confirm that errors are properly reported to Bugsnag when enabled

@morgan-wowk morgan-wowk mentioned this pull request Jan 26, 2026
4 tasks
Copy link
Author

morgan-wowk commented Jan 26, 2026

@morgan-wowk morgan-wowk force-pushed the 01-26-refactor-error-component-names branch from 5002cbc to dc253c8 Compare January 26, 2026 21:02
@morgan-wowk morgan-wowk force-pushed the 01-26-feat_add_bugsnag_error_reporting_service_initialize_bugsnag_sdk_with_custom_error_normalization_and_grouping._reads_configuration_from_environment_variables_and_applies_normalization_to_all_reported_errors branch from 319066c to 80defd3 Compare January 26, 2026 21:02
@morgan-wowk morgan-wowk force-pushed the 01-26-refactor-error-component-names branch from dc253c8 to 9be3ab2 Compare January 26, 2026 21:07
@morgan-wowk morgan-wowk force-pushed the 01-26-feat_add_bugsnag_error_reporting_service_initialize_bugsnag_sdk_with_custom_error_normalization_and_grouping._reads_configuration_from_environment_variables_and_applies_normalization_to_all_reported_errors branch 2 times, most recently from 9688389 to c3cfc88 Compare January 26, 2026 21:10
@morgan-wowk morgan-wowk force-pushed the 01-26-refactor-error-component-names branch from 9be3ab2 to d2ad4cd Compare January 26, 2026 21:10
@morgan-wowk morgan-wowk marked this pull request as ready for review January 26, 2026 21:13
@morgan-wowk morgan-wowk requested a review from a team as a code owner January 26, 2026 21:13
@morgan-wowk morgan-wowk force-pushed the 01-26-feat_add_bugsnag_error_reporting_service_initialize_bugsnag_sdk_with_custom_error_normalization_and_grouping._reads_configuration_from_environment_variables_and_applies_normalization_to_all_reported_errors branch from c3cfc88 to 6cf38f9 Compare January 28, 2026 18:33
@morgan-wowk morgan-wowk force-pushed the 01-26-refactor-error-component-names branch from d2ad4cd to bedad4c Compare January 28, 2026 18:33
@morgan-wowk morgan-wowk force-pushed the 01-26-feat_add_bugsnag_error_reporting_service_initialize_bugsnag_sdk_with_custom_error_normalization_and_grouping._reads_configuration_from_environment_variables_and_applies_normalization_to_all_reported_errors branch from 6cf38f9 to ad2ef91 Compare January 28, 2026 18:48
@morgan-wowk morgan-wowk force-pushed the 01-26-refactor-error-component-names branch from bedad4c to 43e186c Compare January 28, 2026 18:48
@morgan-wowk morgan-wowk changed the base branch from 01-26-feat_add_bugsnag_error_reporting_service_initialize_bugsnag_sdk_with_custom_error_normalization_and_grouping._reads_configuration_from_environment_variables_and_applies_normalization_to_all_reported_errors to graphite-base/1696 January 28, 2026 19:20
@morgan-wowk morgan-wowk force-pushed the 01-26-refactor-error-component-names branch from 43e186c to a8636d6 Compare January 28, 2026 19:21
@morgan-wowk morgan-wowk changed the base branch from graphite-base/1696 to 01-26-feat_add_bugsnag_error_reporting_service_initialize_bugsnag_sdk_with_custom_error_normalization_and_grouping._reads_configuration_from_environment_variables_and_applies_normalization_to_all_reported_errors January 28, 2026 19:21
Copy link
Author

Note: I am actively working on implementing a refactor to simplify the contents of this PR

@morgan-wowk morgan-wowk force-pushed the 01-26-refactor-error-component-names branch from 9322f42 to 43d5e44 Compare January 28, 2026 19:57
@morgan-wowk morgan-wowk force-pushed the 01-26-feat_add_bugsnag_error_reporting_service_initialize_bugsnag_sdk_with_custom_error_normalization_and_grouping._reads_configuration_from_environment_variables_and_applies_normalization_to_all_reported_errors branch from 62bc345 to 58af5dc Compare January 28, 2026 21:27
@morgan-wowk morgan-wowk force-pushed the 01-26-refactor-error-component-names branch from 43d5e44 to dcab8f2 Compare January 28, 2026 21:27
@morgan-wowk morgan-wowk changed the base branch from 01-26-feat_add_error_normalization_and_integrate to graphite-base/1696 January 28, 2026 22:33
@morgan-wowk morgan-wowk force-pushed the 01-26-refactor-error-component-names branch from 5bcb71f to 15c6748 Compare January 28, 2026 22:34
@morgan-wowk morgan-wowk changed the base branch from graphite-base/1696 to 01-26-feat_add_error_normalization_and_integrate January 28, 2026 22:34
@morgan-wowk morgan-wowk force-pushed the 01-26-refactor-error-component-names branch from 15c6748 to 61c8e8c Compare February 3, 2026 21:47
@morgan-wowk morgan-wowk force-pushed the 01-26-feat_add_error_normalization_and_integrate branch 2 times, most recently from 0dcd36d to c7d466b Compare February 3, 2026 21:49
@morgan-wowk morgan-wowk force-pushed the 01-26-refactor-error-component-names branch from 61c8e8c to 7c245df Compare February 3, 2026 21:49
@morgan-wowk morgan-wowk force-pushed the 01-26-feat_add_error_normalization_and_integrate branch from c7d466b to 54c9881 Compare February 3, 2026 21:50
@morgan-wowk morgan-wowk force-pushed the 01-26-refactor-error-component-names branch 2 times, most recently from 70faa8f to 962f3c9 Compare February 3, 2026 21:54
@morgan-wowk morgan-wowk force-pushed the 01-26-feat_add_error_normalization_and_integrate branch from 54c9881 to b717d56 Compare February 3, 2026 21:54
Copy link
Collaborator

@Mbeaulne Mbeaulne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some smallish changes but looks good!


useEffect(() => {
if (isBugsnagEnabled() && error instanceof Error) {
Bugsnag.notify(error, (event) => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

event should have a type

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added

useEffect(() => {
if (isBugsnagEnabled() && error instanceof Error) {
Bugsnag.notify(error, (event) => {
event.addMetadata("error_handler", {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have a constant for error_handler?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do now!

}, [error]);

const handleRefresh = () => {
reset?.();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: instead of reset?.(); can we just write reset() and in the function signature add a default value to reset?

reset = () =>{}

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I took your recommendation and added a default value


const GENERIC_ERROR_CLASS = "Error";

export const isBugsnagEnabled = (): boolean => Boolean(BUGSNAG_API_KEY);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this could be written like:

export const IS_BUGSNAG_ENABLED = Boolean(BUGSNAG_API_KEY);

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup! Changed

@morgan-wowk morgan-wowk force-pushed the 01-26-feat_add_error_normalization_and_integrate branch from b717d56 to e31158e Compare February 5, 2026 22:20
@morgan-wowk morgan-wowk force-pushed the 01-26-refactor-error-component-names branch from 962f3c9 to 5301a3c Compare February 5, 2026 22:20
@morgan-wowk morgan-wowk force-pushed the 01-26-feat_add_error_normalization_and_integrate branch 2 times, most recently from 7560f78 to 2671a92 Compare February 5, 2026 22:34
@morgan-wowk morgan-wowk force-pushed the 01-26-refactor-error-component-names branch 2 times, most recently from cebab76 to fcc5dcb Compare February 5, 2026 22:44
@morgan-wowk morgan-wowk force-pushed the 01-26-feat_add_error_normalization_and_integrate branch from 2671a92 to 95adc7b Compare February 5, 2026 22:44
@morgan-wowk morgan-wowk changed the base branch from 01-26-feat_add_error_normalization_and_integrate to graphite-base/1696 February 5, 2026 22:47
@morgan-wowk morgan-wowk force-pushed the 01-26-refactor-error-component-names branch from fcc5dcb to 22efe5e Compare February 5, 2026 22:48
@graphite-app graphite-app bot changed the base branch from graphite-base/1696 to master February 5, 2026 22:48
@morgan-wowk morgan-wowk force-pushed the 01-26-refactor-error-component-names branch from 22efe5e to fbedc98 Compare February 5, 2026 22:48
Copy link
Author

morgan-wowk commented Feb 5, 2026

Merge activity

  • Feb 5, 10:52 PM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Feb 5, 10:52 PM UTC: @morgan-wowk merged this pull request with Graphite.

@morgan-wowk morgan-wowk merged commit 1df39d6 into master Feb 5, 2026
8 checks passed
@morgan-wowk morgan-wowk deleted the 01-26-refactor-error-component-names branch February 5, 2026 22:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants