error.name missing regularly, contained in message
- Dominant language
- JavaScript
- Stars
- 1.1k
- Forks
- 162
- PR merge metrics
- No merged PRs in 30d
Description
I observed that while `error.name` is empty regularly, some browsers prepend it to the message.
E.g. when having
``` js
throw new DOMException("INDEX_SIZE_ERR");
```
Those are the observed values:
**Opera 12.12**
Name: `null`
Message: `Uncaught exception: Error: DOMException: INDEX_SIZE_ERR`
**Android Browser 4.2 + 4.4**
Name: `null`
Message: `Uncaught DOMException: INDEX_SIZE_ERR`
**Edge 12 + 13**
Name: `null`
Message: `DOMException: INDEX_SIZE_ERR`
Or when having this:
``` js
throw new Error('Foo')
```
I saw this in the logs:
**Safari 9**
Name: `null`
Message: `Error: Foo`
I also observed native errors like this:
**Safari 9**
Name: `null`
Message: `TypeError: foo.bar is not a function`
Is there any interest in normalizing this stuff in TraceKit? I think we could parse the names out of the message quite easily using some RegEx magic.
I could implement this if it is something you would include in TraceKit.
Contributor guide
No contributing guide indexed for this repository
Research direction
No file, test, or entry point is named. Start by reviewing TraceKit's existing error normalization and comparing the browser examples in this issue; done means consistently extracting or preserving error names without changing unrelated messages, with coverage for the listed DOMException, Error, and TypeError cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- web-dev
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100