-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
fix: catch exceptions from SourceMapConsumer #1098
Conversation
I ran into a similar problem. Karma was just dying with
and I couldn't figure out why. After modifying Side note: I'm using browserify, and I think with |
i'm running into the similar error - is there any way this is going to be merged soon? |
original.line, original.column); | ||
} catch (e) { | ||
// ignore, fall back to non-source-mapped formatting. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can output to warn log message about failing SourceMapConsumer
👍 |
\cc @afischer-sfly @akenn @jeeyoungk @paldepind Guys are you use karma-jasmine? |
Thanks @afischer-sfly I agree this needs to be fixed. |
Using this change I see the following:
The issue with Firefox here is that it looks like the first line contains a line number, but the stack trace hasn't actually started yet. The next line is the actual stack trace and the source map works as expected. In this case I think just logging a warning that there was an error in the SourceMapConsumer would suffice, and you shouldn't need to change the existing regex at all. Or maybe forego attempting source map line number changes on the first line of an error, but I don't know how well that will play with all the other browsers that I'm not using. |
When can we get this PR in? +1 |
@afischer-sfly can you rebase on master and logging error Thanks |
no problem, just pushed a revised change that includes logging. Happy to make any other changes too.
Yup we use karma-jasmine |
@afischer-sfly Thanks! Left to correct jshint errors |
For what it's worth, I'm using karma, mocha, chai, sinon and got the 'TypeError: Line must be greater or equal to 1, got 0' from source-map when setting up sinon-as-promised. Applying this PR fixed it. |
LGTM |
👍 When can we get this PR in? |
@dazz Thanks |
/cc @karma-runner/owners Can we get a second sign off on this? |
I use karma + jasmine and got this error when running against Firefox (not Chrome, interestingly). This patch fixed it. |
I ran into the same error with Phantomjs2. I then added the commit from this pull request to the current master in my own fork, ran "grunt build" and the error was replaced by a warning. That and lots of other error messages, but hopefully those are specific to my project. |
Can this get merged in, please? |
fix: catch exceptions from SourceMapConsumer
Thanks @maksimr! Still working on getting the release process sorted out. |
@zoo no problems! This PR fix only symptom, source of the problem I describe here. Under the task #1274 we can make more robust solution, about which said @vojtajina
|
I don't like just catching the error, but it seems to me it shouldn't even try to get original location from sourcemap if the regular expression did not match a line number. |
The symptom of this issue is that the test runner will die with the following error:
The way the error happened:
This pull request wraps
SourceMapConsumer.originalPositionFor
in a try-catch block.