microsoft / microsoft/ApplicationInsights-JS

Log cause when calling trackException

Open
#2,172 2 comments 8 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
TypeScript
Stars
685
Forks
261
Avg merge
21h 33m
Merged PRs (30d)
5

Description

**Is your feature request related to a problem? Please describe.**
When using `trackException` it looks like it's not propagating the [cause](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the trackException entry point in the ApplicationInsights-JS codebase and inspect how Error data is currently collected. Use the linked MDN reference to understand Error.cause, then determine how its presence should appear in tracked exception data and how the stack should be handled; done means the cause is logged without requiring callers to add a custom property.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
observability
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.