Log cause when calling trackException
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
- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/cause
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
Errorcause 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.
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