-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Error message for syntax error missing location in 4.2.1+ #1562
Comments
This is also biting us over in the Ember world. The error messages on 4.2.1+ are completely useless (there is absolutely no indication of what is wrong in the template). Here is an easy way to display the published package diff between 4.2.0 and 4.2.1: |
I suspect the issue is from this change in the published bundle (at parseError: function parseError(str, hash) {
- throw new Error(str);
+ if (hash.recoverable) {
+ this.trace(str);
+ } else {
+ var _parseError = function _parseError(msg, hash) {
+ this.message = msg;
+ this.hash = hash;
+ };
+
+ _parseError.prototype = new Error();
+
+ throw new _parseError(str, hash);
+ }
}, |
Based on the output, it appears that even though the It looks like version v4.2.1 and newer have been published with @nknapp - Can you confirm that the location you publish from has the correct version of |
This is required until handlebars-lang/handlebars.js#1562 is fixed.
I'll have to check. Thanks for the hint. Indeed, the npm package is published from my local computer. I may have switched to the master branch and back without running "npm ci'. The version that can be downloaded from handlebarsjs.com should be OK than, because it is built in Travis. Could you check? |
And I would be grateful if you (or anybody else) could contribute a test case. I wonder why no test exists for that case. Everything else is well tested... |
Actually, 4.x should use jison 0.3.x |
Aye, I updated my comment above with more info after realizing that 4.x had been branched from master quite a long time ago and that the
Yes, I can double check it’s contents, but since I’m using handlebars as a nested dependency in a node project it’s a bit hard to actually use that version as a stop gap solution. Still happy to check and confirm your suspicion though.
I will try to work on a test case later this afternoon (if someone else doesn’t beat me to it 😉). |
I'll try to get it reproduced as well. |
The strange thing is: There is a test case. And since the release is done with "generator-release", it should have failed. As far as I know, the tests are ran with the built js-files. I don't really understand how this could happen. |
I have re-published all 4.2.1+ versions (4.2.2, 4.3.5 and 4.4.2). They should work (I have tested manually). |
Thank you very much @nknapp! |
It seems like there was a change (I assume from looking at the commits the change was in the auto generated code that is not checked in) where the
err.stack
no longer includes theerr.message
, which explains what the syntax error is. Most places that log an error that want a stack trace willconsole.log(err.stack)
assuming thaterr.message
is included on the first line, and it was though the 4.2.0 release, no with 4.2.1+ it is missing.Example code to reproduce:
In 4.2.0 and prior versions, that produces the following:
But in 4.2.1+ it produces the following:
The text was updated successfully, but these errors were encountered: