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

fix(node): report errorMiddleware errors as unhandled #8048

Conversation

chdsbd
Copy link
Contributor

@chdsbd chdsbd commented May 5, 2023

I found it confusing that unhandled errors caught by the express.js middleware were being reported as handled

This change updates the behavior to match Sentry-Python's Django integration: https://github.com/getsentry/sentry-python/blob/81afcea403c0ac148d631164de29ed80d6a64840/sentry_sdk/integrations/asgi.py#L58

I could use help testing this

Before submitting a pull request, please take a look at our
Contributing guidelines and verify:

  • If you've added code that should be tested, please add tests.
  • Ensure your code lints and the test suite passes (yarn lint) & (yarn test).

@@ -304,6 +305,11 @@ export function errorHandler(options?: {
}
}

_scope.addEventProcessor(event => {
addExceptionMechanism(event, { type: 'middleware', handled: false });
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Idk what the type here should be. I was going to write "express", but this middleware can be used by many different libraries, unlike the sveltkit and angular integrations.

Copy link
Member

Choose a reason for hiding this comment

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

I think middleware is fine for this, makes sense to me!

@AbhiPrasad AbhiPrasad changed the title report errorMiddleware errors as unhandled fix(node): report errorMiddleware errors as unhandled May 8, 2023
@cdignam-segment
Copy link

@AbhiPrasad is it possible to get a decision on merging this?

Copy link
Member

@AbhiPrasad AbhiPrasad left a comment

Choose a reason for hiding this comment

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

went on vacation so this dropped off my radar! Thanks for your patience, lgtm!

@github-actions
Copy link
Contributor

This pull request has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you label it Status: Backlog or Status: In Progress, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

@cdignam-segment
Copy link

@AbhiPrasad it would be cool if this could be merged in to main

@AbhiPrasad
Copy link
Member

@cdignam-segment mind rebasing the branch? Then I'll merge in so we can get it out with the next release.

I found it confusing that unhandled errors caught by the express.js middleware were being reported as handled

This change updates the behavior to match Sentry-Python's Django integration: https://github.com/getsentry/sentry-python/blob/81afcea403c0ac148d631164de29ed80d6a64840/sentry_sdk/integrations/asgi.py#L58
@chdsbd chdsbd force-pushed the chdsbd/mark-error-handler-errors-unhandled branch from ef053f8 to 2c184c9 Compare June 30, 2023 18:37
@chdsbd
Copy link
Contributor Author

chdsbd commented Jun 30, 2023

@AbhiPrasad Great! I've rebased my commits

@AbhiPrasad AbhiPrasad merged commit 3625fb1 into getsentry:develop Jul 1, 2023
@chdsbd chdsbd deleted the chdsbd/mark-error-handler-errors-unhandled branch July 1, 2023 12:57
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.

4 participants