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

Log cause when calling trackException #2172

Open
orjan opened this issue Oct 3, 2023 · 2 comments
Open

Log cause when calling trackException #2172

orjan opened this issue Oct 3, 2023 · 2 comments

Comments

@orjan
Copy link

orjan commented Oct 3, 2023

Is your feature request related to a problem? Please describe.
When using trackException it looks like it's not propagating the cause of the error. This would be really helpful so we're not loosing the context of the error.

Describe the solution you'd like
Log the cause if present? Not sure how the stack should be handled.

Describe alternatives you've considered
Manually adding the cause as custom property, but that needs to handled in all places where an exception is tracked.

Additional context

@MSNev
Copy link
Collaborator

MSNev commented Oct 3, 2023

I agree, including as much context as possible for Exceptions is always a good thing (so tagging as an enhancement), however, this will require some investigation before we can provide a possible release / timeframe. Adding some initial thoughts / notes for when we come back to this for some context. Please feel free to add comments on your preferences and any other option that might work in the mean time (like just added as a additional property -- but this would not appear in the Azure Monitor UX for automatic un0minification)

Notes.

We will need to identify how we propagate this information to the backend for the Azure Monitor to be able to provide the most relevant (helpful) data when this is passed.

Either we

  • Append and contained Error cause to the stack trace so it's listed as "Caused by" or something
  • Prepend (reverse of above)
  • Introduce a new field (this will likely need both Server / Storage and UX work)
  • Technically, the "exception" is sent as an array, so need to try whether passing the cause as another exception work for the "browser" flow (it exists for other languages), so will need to verify if passed that all of the storage and UX works as expected.

@johncrim
Copy link

When you add this, please also consider adding support for AggregateError.errors, which is similar functionally but can include multiple errors:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/AggregateError

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants