Questions regarding: Rolling your own Angular error handler #8991
Unanswered
bjornharvold
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi Team Sentry 👋🏻
The intention behind rolling my own is because we want to use it in our consumable Web Components and we don't want to catch any parent errors.
I asked this question earlier and your team members gave me a good head start to do this myself.
I started here: https://docs.sentry.io/platforms/javascript/troubleshooting/#using-a-client-directly
Then copied your default Angular error handler from here: https://github.com/getsentry/sentry-javascript/blob/master/packages/angular/src/errorhandler.ts
and made it my own like this:
Now I have 2 questions regarding this implementation (note that all my references to Sentry here is from @sentry/angular-ivy):
and replaced with:
I am not sure how to do the same using the hub.withScope and I am thinking that if I don't do it, I wont get all the defaults scope that is currently available on all my errors through the Sentry UI (See screenshot).

Is this going to be an issue in a Sentry "embedded context" such as the Angular error handler I have created? I see that it's reaching out to WINDOW.location and of course this will not be owned by me but by our integrators. Guessing I might not be able to enable tracing within a Web Component embedded in a foreign site. 🤔
Anything else I should be aware of and do you see any improvements that can be made to what we've implemented?
Feel free to use this code in your examples for other Angular folks passing by.
Bjorn 🍺
Beta Was this translation helpful? Give feedback.
All reactions