Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zinnia: fix double reporting of crash errors #434

Merged
merged 6 commits into from
May 3, 2024

Conversation

juliangruber
Copy link
Member

@juliangruber juliangruber commented Apr 26, 2024

  • swap sentry token

@juliangruber juliangruber requested a review from bajtos April 26, 2024 16:40
lib/zinnia.js Outdated
@@ -276,6 +279,8 @@ const catchChildProcessExit = async ({
maybeReportErrorToSentry(moduleErr)
})
}
// If it should be reported, it was already handled
err.reportToSentry = false
Copy link
Member

Choose a reason for hiding this comment

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

I am a bit confused about why we are reporting the error to Sentry twice. Shouldn't we fix that instead of adding a new flag to the error object?

The condition at the top of this file checks err.shouldReportToSentry, but this code is setting err.reportToSentry.

How can we (manually) verify that the changes in the pull request work as intended?

Copy link
Member Author

Choose a reason for hiding this comment

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

I am a bit confused about why we are reporting the error to Sentry twice. Shouldn't we fix that instead of adding a new flag to the error object?

Absolutely, we're fixing it by adding the flag :D Or at least that's the plan.

The problem is this: There's an inner try/catch and an outer try/catch. The inner try/catch reports the error to Sentry. It then also throws the error, because that is required for control flow (so that the outer loop ends). In this outer loop, we're catching all errors and reporting them to Sentry. By adding the flag we're telling the outer catch handler that the error has already been submitted to Sentry.

Do you have another suggestion how to implement this?

@juliangruber juliangruber requested a review from bajtos April 29, 2024 14:33
@juliangruber
Copy link
Member Author

I have changed the sentry key and disabled the old one

Copy link
Member

@bajtos bajtos left a comment

Choose a reason for hiding this comment

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

I prefer slightly more reportedToSentry over reportToSentry for the following reasons:

  • reportedToSentry describes what happened. When nobody reads/interprets this field, then it's ok - we are telling what happened, not asking what to do
  • I understand reportToSentry as a command asking some other piece of code to report this error to Sentry. If that other piece of code does not report the error, then this command will be unfulfilled.

I also find it a bit weird when a property has a default value of true.

At the same time, this is subjective and a minor detail, so I am okay with landing this PR as it is now.

@juliangruber juliangruber merged commit 856cb55 into main May 3, 2024
15 checks passed
@juliangruber juliangruber deleted the fix/zinnia-crash-double-reporting branch May 3, 2024 05:59
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