error-stack-parser icon indicating copy to clipboard operation
error-stack-parser copied to clipboard

"Global code" casing inconsistency

Open bengourley opened this issue 6 years ago • 2 comments

Hi there, first off thanks for an incredible useful collection of modules! 👍

Expected Behavior

I would expect StackFrame.functionName to be consistent across browsers.

Current Behavior

The parsed stack from two different browsers (e.g. Safari 11 vs. Edge 14) which originated in the top level of a <script> tag, yields two distinct strings for StackFrame.functionName:

"Global code" (Safari 11) vs "global code" (Edge 14)

Context

I notice that there are test cases for both versions of this string:

https://github.com/stacktracejs/error-stack-parser/blob/8f4c8711286c0a2239184d4d6fae7918c6586922/spec/error-stack-parser-spec.js#L47 https://github.com/stacktracejs/error-stack-parser/blob/8f4c8711286c0a2239184d4d6fae7918c6586922/spec/error-stack-parser-spec.js#L145

So I wonder if this is intentional?

Possible Solution

Personally I would like the library to normalize this string such that stacktraces are more consistent between browsers but I want to know if it is intentionally like this.

If you agree that it should be normalized, I'd be happy to supply a pull request.

Cheers!

bengourley avatar Oct 12 '17 11:10 bengourley

Browsers generally have slightly different views on these things as there's no standardization (yet). You're not the first person to ask for normalization, but I would recommend a separate module that can be overlaid atop error-stack-parser. In fact, @auchenberg did a similar thing with error-stack-normalizer though sadly it could not be open-sourced.

I would be willing to provide technical guidance, but I could not take on such a project myself these days as I'm generally fully heads down on the Gradle build tool. What do you think?

eriwen avatar Oct 13 '17 23:10 eriwen

That's ok - if normalisation isn't a goal of this project I'll close the issue. Thanks for the thorough response and the offer to help!

On Sat, 14 Oct 2017, 01:25 Eric Wendelin, [email protected] wrote:

Browsers generally have slightly different views on these things as there's no standardization (yet). You're not the first person to ask for normalization, but I would recommend a separate module that can be overlaid atop error-stack-parser. In fact, @auchenberg https://github.com/auchenberg did a similar thing with error-stack-normalizer https://www.npmjs.com/package/error-stack-normalizer though sadly it could not be open-sourced.

I would be willing to provide technical guidance, but I could not take on such a project myself these days as I'm generally fully heads down on the Gradle build tool. What do you think?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/stacktracejs/error-stack-parser/issues/40#issuecomment-336589574, or mute the thread https://github.com/notifications/unsubscribe-auth/AAlNK_-230RhnPb42oR7rBEgqzAh9tDZks5sr_FagaJpZM4P22ym .

bengourley avatar Oct 18 '17 11:10 bengourley