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

HttpErrorResponse Capturing Problem #15239

Open
3 tasks done
cobyeastwood183 opened this issue Jan 31, 2025 · 1 comment
Open
3 tasks done

HttpErrorResponse Capturing Problem #15239

cobyeastwood183 opened this issue Jan 31, 2025 · 1 comment
Assignees
Labels
Package: angular Issues related to the Sentry Angular SDK Type: Bug

Comments

@cobyeastwood183
Copy link

cobyeastwood183 commented Jan 31, 2025

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/angular

SDK Version

8.52.0

Framework Version

19.1.0

Link to Sentry event

No response

Reproduction Example/SDK Setup

https://github.com/cobyeastwood183/angular

error.json

Steps to Reproduce

  1. npm install
  2. add DSN
  3. npm start
  4. visit http://localhost:4200/test
  5. click button "Test API 2(Localhost)"

Expected Result

Expect a HttpException to be captured for HttpErrorResponse.

Actual Result

Instead 'unknown' is captured when caught by the ErrorHandler or 'Object.error' when caught by calling captureException.

@cobyeastwood183 cobyeastwood183 added Package: angular Issues related to the Sentry Angular SDK Type: Bug labels Jan 31, 2025
@Lms24 Lms24 self-assigned this Jan 31, 2025
@Lms24
Copy link
Member

Lms24 commented Jan 31, 2025

Dumping my thoughts from the slack conversation here. I don't have time to look at this today but will continue on Monday.

I’ll summarize my preliminary findings from checking out the repro (thanks a lot btw!):

  • If you call captureException when handling the error, it won’t go through the ErrorHandler but will be sent directly to Sentry. In this case, the error object ends up with the Exception Captured With Keys message that you encountered.
    • Maybe we can apply the same extraction logic as in the ErrorHandler within the Angular SDK. let me think about this for a bit.
  • Letting the error bubble up via the ErrorHandler, leads to the error in Sentry.
    • The “” error type must have been changed recently in the product or during ingest because we add a title property to the event which is “” . The SDK doesn’t set title at all. So some kind of inference logic is going wrong here… I asked ingest the issues team about this
    • The other problem is that we capture much less information about this error than if we’d directly call captureException on it directly. Most importantly, we loose the stack trace
    • We could add a stack trace but due to Angular’s ZoneJS usage, it’s pretty worthless because it doesn’t point back to the user source code. Not sure yet if we can solve this but it doesn’t look trivial.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Package: angular Issues related to the Sentry Angular SDK Type: Bug
Projects
None yet
Development

No branches or pull requests

2 participants