when require a file within a syntax error, the error file name and line number won't set into err.message, but this is fixed in node 6. will we land this fix in node@4 ?
// t.js
try {
require('./r.js')
} catch (err) {
console.log(err.stack)
}
// r.js
function // syntax error
in 4 and 5, err.stack will be:
SyntaxError: Unexpected token }
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:387:25)
at Object.Module._extensions..js (module.js:422:10)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Module.require (module.js:367:17)
at require (internal/module.js:16:19)
at Object.<anonymous> (/Users/deadhorse/git/basement/t.js:2:3)
at Module._compile (module.js:413:34)
at Object.Module._extensions..js (module.js:422:10)
in 0.12 and 6, err.stack will be:
/Users/deadhorse/git/basement/r.js:3
});
^
SyntaxError: Unexpected token }
at Object.exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:513:28)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:458:32)
at tryModuleLoad (module.js:417:12)
at Function.Module._load (module.js:409:3)
at Module.require (module.js:468:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/Users/deadhorse/git/basement/t.js:2:3)
at Module._compile (module.js:541:32)
/cc @nodejs/lts Is this something that can be backported or are we pretty firm on not allowing _any_ changes to error messages (especially in LTS)?
Doubtful, is this coming directly from V8 so would mean patching V8? Can we narrow down the change that would need to be backported to assess the impact?
Oh, no it's not from V8 is it, it's the bit with the filename isn't it? @mscdex do you know the commit here that changed this?
Not offhand, no.
bingo, thanks @evanlucas, we may be able to treat this as a bugfix. @nodejs/lts see #4874 and weigh in
errors are always a tough one, as it could be viewed as a contract. Modifying the stack message in particular could break things in unexpected ways. Personally I'll defer to @jasnell on this one as I know he has pretty strong opinions regarding error messages. It may also be interesting to hear how various APM providers feel about this
/cc @nodejs/diagnostics @watson @groundwater @Qard
Yeah, while I recognize this is a bug fix, error messages are tricky things. I'm not that comfortable pulling this back.
Fair enough, we have to be very conservative with v4. Thanks for the bug report @dead-horse but I don't think we can take this any further.
@dead-horse I know that @jasnell was working on https://github.com/nodejs/node/pull/6573 which has seemed to stall. This would potentially make it easier for us to make error messages extensible without requiring semver major bumps
It's not so much stalled as it is pending. The ctc decision was to hold off
on landing the changes for a bit. I need to get it rebased and updated and
I'll be revisiting it in Aug/Sept.
On Jul 7, 2016 11:27 PM, "Myles Borins" [email protected] wrote:
@dead-horse https://github.com/dead-horse I know that @jasnell
https://github.com/jasnell was working on #6573
https://github.com/nodejs/node/pull/6573 which has seemed to stall.
This would potentially make it easier for us to make error messages
extensible without requiring semver major bumps—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/nodejs/node/issues/7578#issuecomment-231285109, or mute
the thread
https://github.com/notifications/unsubscribe/AAa2eZpsqNj7d8B8Nnne_JdQGMH9xnaFks5qTe3agaJpZM4JGvs-
.
Please provide me solution for this issue.
react-native run-ios
/Users/kraftly03/MyNewProject/node_modules/@babel/core/lib/transformation/file/file.js:63
constructor(options, {
^
SyntaxError: Unexpected token {
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:387:25)
at Module._extensions..js (module.js:422:10)
at Object.require.extensions.(anonymous function) [as .js] (/Users/kraftly03/MyNewProject/node_modules/babel-register/lib/node.js:152:7)
at Module.load (module.js:357:32)
at Function.Module._load (module.js:314:12)
at Module.require (module.js:367:17)
at require (internal/module.js:16:19)
at Object.
at Module._compile (module.js:413:34)
MyNewProject
@manojkraftly No "fix my code for me" comment spam, please. Open an issue in nodejs/help, that's what it's for.
@bnoordhuis I am not getting you, what you trying to explain me...
@manojkraftly You are necroing an old bug report that's only superficially similar to your issue. Don't do that, open an issue here.
Most helpful comment
bingo, thanks @evanlucas, we may be able to treat this as a bugfix. @nodejs/lts see #4874 and weigh in