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 the err.message, which explains what the syntax error is. Most places that log an error that want a stack trace will console.log(err.stack) assuming that err.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:
node -pe 'require("handlebars").parse("{{")'
In 4.2.0 and prior versions, that produces the following:
$ node -pe 'require("handlebars").parse("{{")'
node_modules/handlebars/dist/cjs/handlebars/compiler/parser.js:267
throw new Error(str);
^
Error: Parse error on line 1:
{{
--^
Expecting 'ID', 'STRING', 'NUMBER', 'BOOLEAN', 'UNDEFINED', 'NULL', 'DATA', got 'EOF'
at Object.parseError (node_modules/handlebars/dist/cjs/handlebars/compiler/parser.js:267:19)
at Object.parse (node_modules/handlebars/dist/cjs/handlebars/compiler/parser.js:336:30)
at HandlebarsEnvironment.parse (node_modules/handlebars/dist/cjs/handlebars/compiler/base.js:46:43)
at [eval]:1:23
at ContextifyScript.Script.runInThisContext (vm.js:25:33)
at Object.runInThisContext (vm.js:97:38)
at Object.<anonymous> ([eval]-wrapper:6:22)
at Module._compile (module.js:577:32)
at evalScript (bootstrap_node.js:358:27)
at run (bootstrap_node.js:133:11)
But in 4.2.1+ it produces the following:
$ node -pe 'require("handlebars").parse("{{")'
Error
at Object.parseError (node_modules/handlebars/dist/cjs/handlebars/compiler/parser.js:278:41)
at Object.parse (node_modules/handlebars/dist/cjs/handlebars/compiler/parser.js:365:26)
at HandlebarsEnvironment.parse (node_modules/handlebars/dist/cjs/handlebars/compiler/base.js:46:43)
at [eval]:1:23
at ContextifyScript.Script.runInThisContext (vm.js:25:33)
at Object.runInThisContext (vm.js:97:38)
at Object.<anonymous> ([eval]-wrapper:6:22)
at Module._compile (module.js:577:32)
at evalScript (bootstrap_node.js:358:27)
at run (bootstrap_node.js:133:11)
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.stackno 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.messageis 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: