Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Process all frames on the stack even if some error out. Added option… #2

Closed
wants to merge 1 commit into from
Closed

Conversation

michaelrawks
Copy link

@michaelrawks michaelrawks commented Apr 1, 2020

PURPOSE OF MODIFICATION:
There was a frame in the middle of my stack that BasicSourceMapConsumer.originalPositionFor was erroring out on (no line# in this case), but I had more frames in the stack that I was curious if BasicSourceMapConsumer.originalPositionFor could get positions for. It can in my cases. Unfortunately, I can't provide the map to proprietary code to help with this example, but I think the code makes sense. There are other options that could of been implemented for this specific example, but I like the idea of processing the next frame regardless of what error the consumer comes up with for the current frame.

EXAMPLE STACK:
TypeError: Cannot read property 'IsCompleteFlag' of undefined
at Module.p(x.js:1:2789898)
at ? (x.js:1:746448)
at Array.forEach()
at Ci(x.js:1:746410)
at ? (x.js:1:746256)
at ? (x.js:1:742338)
at Object.next(x.js:1:742443)
at o(x.js:1:741211)

ORIGINAL OUTPUT:
Stops at at Array.forEach().

stacktracify .\WorkAreaKeepOut\main.9c2573c77290926e9a91.chunk.js.map --file .\WorkAreaKeepOut\UglyTraceOrig.txt
at IsCompleteFlag (DigiDataServiceAPI/Activity/Activity.ts:61:19)
at IsTodayTomorrowAppointment (store/states/Activity/ActivityActionCreator.ts:323:45)
Error: Line numbers must be >= 1
at BasicSourceMapConsumer.originalPositionFor (C:\Users\x\AppData\Roaming\npm\node_modules\stacktracify\node_modules\source-map\lib\source-map-consumer.js:495:13)
at stack.forEach (C:\Users\x\AppData\Roaming\npm\node_modules\stacktracify\index.js:53:23)
at Array.forEach ()
at C:\Users\x\AppData\Roaming\npm\node_modules\stacktracify\index.js:52:11

MODIFIED OUTPUT:
Keeps going past at Array.forEach() (or anything else that might error out).

stacktracify .\WorkAreaKeepOut\main.9c2573c77290926e9a91.chunk.js.map --file .\WorkAreaKeepOut\UglyTraceOrig.txt
TypeError: Cannot read property 'IsCompleteFlag' of undefined
at IsCompleteFlag (x/xy/xyz.ts:61:19)
at IsTodayTomorrowAppointment (x/xy/xyz/a.ts:323:45)
at forEach (x/xy/xyz/a.ts:322:15)
at updateAppointmentActivityCounts (x/xy/xyz/a.ts:309:16)
at (m/n/o.ts:8:0)
at (m/n/o.ts:8:0)
at (m/n/o.ts:8:0)
Error: Line numbers must be >= 1
at BasicSourceMapConsumer.originalPositionFor (C:\Users\x\AppData\Roaming\npm\node_modules\stacktracify\node_modules\source-map\lib\source-map-consumer.js:495:13)
at stack.forEach (C:\Users\x\AppData\Roaming\npm\node_modules\stacktracify\index.js:61:21)
at Array.forEach ()
at C:\Users\x\AppData\Roaming\npm\node_modules\stacktracify\index.js:59:11

CAN STILL GET ORIGINAL OUTPUT WITH OPTION:

stacktracify .\WorkAreaKeepOut\main.9c2573c77290926e9a91.chunk.js.map --file .\WorkAreaKeepOut\UglyTraceOrig.txt --stoponfirst
at IsCompleteFlag (DigiDataServiceAPI/Activity/Activity.ts:61:19)
at IsTodayTomorrowAppointment (store/states/Activity/ActivityActionCreator.ts:323:45)
Error: Line numbers must be >= 1
at BasicSourceMapConsumer.originalPositionFor (C:\Users\x\AppData\Roaming\npm\node_modules\stacktracify\node_modules\source-map\lib\source-map-consumer.js:495:13)
at stack.forEach (C:\Users\x\AppData\Roaming\npm\node_modules\stacktracify\index.js:53:23)
at Array.forEach ()
at C:\Users\x\AppData\Roaming\npm\node_modules\stacktracify\index.js:52:11

@mifi
Copy link
Owner

mifi commented Apr 8, 2020

Why do we want to stop on first by default?

@mifi
Copy link
Owner

mifi commented Apr 8, 2020

It's indeed a bug. I managed to reproduce this error with this line: at Array.forEach (native)

mifi added a commit that referenced this pull request Apr 8, 2020
Where lineNumber is not valid
Also catch any error and continue
@mifi
Copy link
Owner

mifi commented Apr 8, 2020

Thanks for reporting. I decided to fix it in a slightly different way

@mifi mifi closed this Apr 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants