TraceKit icon indicating copy to clipboard operation
TraceKit copied to clipboard

error.name missing regularly, contained in message

Open thomasbachem opened this issue 9 years ago • 4 comments

I observed that while error.name is empty regularly, some browsers prepend it to the message.

E.g. when having

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:

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.

thomasbachem avatar Jan 09 '16 14:01 thomasbachem

My only concern is how do we insure it's always populated correctly. I'd be more than happy to accept this if you have tests for every browser and it works as expected. This would be a very welcoming change.

niemyjski avatar Jan 12 '16 16:01 niemyjski

@thomasbachem would you mind submitting a pull request for this with tests.

niemyjski avatar Feb 04 '16 19:02 niemyjski

@thomasbachem Any chance you can provide a pr for this :).

niemyjski avatar Jun 20 '16 16:06 niemyjski

Sadly not :/ I'm out of coding for some time and focussing on other stuff.

thomasbachem avatar Jun 20 '16 20:06 thomasbachem