{"action":"created","issue":{"url":"https://api.github.com/repos/nodejs/node/issues/3411","repository_url":"https://api.github.com/repos/nodejs/node","labels_url":"https://api.github.com/repos/nodejs/node/issues/3411/labels{/name}","comments_url":"https://api.github.com/repos/nodejs/node/issues/3411/comments","events_url":"https://api.github.com/repos/nodejs/node/issues/3411/events","html_url":"https://github.com/nodejs/node/issues/3411","id":111912940,"number":3411,"title":"SyntaxError objects should contain information about where the syntax error happened","user":{"login":"fresheneesz","id":149531,"avatar_url":"https://avatars.githubusercontent.com/u/149531?v=3","gravatar_id":"","url":"https://api.github.com/users/fresheneesz","html_url":"https://github.com/fresheneesz","followers_url":"https://api.github.com/users/fresheneesz/followers","following_url":"https://api.github.com/users/fresheneesz/following{/other_user}","gists_url":"https://api.github.com/users/fresheneesz/gists{/gist_id}","starred_url":"https://api.github.com/users/fresheneesz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fresheneesz/subscriptions","organizations_url":"https://api.github.com/users/fresheneesz/orgs","repos_url":"https://api.github.com/users/fresheneesz/repos","events_url":"https://api.github.com/users/fresheneesz/events{/privacy}","received_events_url":"https://api.github.com/users/fresheneesz/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/nodejs/node/labels/vm","name":"vm","color":"bfdadc"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-10-16T21:17:52Z","updated_at":"2016-04-12T14:41:50Z","closed_at":null,"body":"Consider these files:\r\n\r\ntest.js:\r\n```\r\ntry {\r\n    require(\"./testmodule\")\r\n} catch(e) {\r\n    console.log(e.stack)\r\n}\r\n```\r\n\r\ntestmodule.js:\r\n```\r\n}\r\n```\r\n\r\nIn this case, the result is the following text:\r\n\r\n```\r\nSyntaxError: Unexpected token }\r\n    at exports.runInThisContext (vm.js:53:16)\r\n    at Module._compile (module.js:413:25)\r\n    at Object.Module._extensions..js (module.js:452:10)\r\n    at Module.load (module.js:355:32)\r\n    at Function.Module._load (module.js:310:12)\r\n    at Module.require (module.js:365:17)\r\n    at require (module.js:384:17)\r\n    at Object.<anonymous> (/home/vagrant/temp/test.js:2:5)\r\n    at Module._compile (module.js:434:26)\r\n    at Object.Module._extensions..js (module.js:452:10)\r\n```\r\n\r\nNotice that it doesn't give you any information about what module that unexpected token is in nor what line in the module that unexpected token was found at. This makes it pretty hard to debug in cases where you're requiring a module somewhere other than at the very top of your source. \r\n\r\nYou can usually infer the module its in by looking at the line in test.js that it indicates, but if you have more than one module required in the same line, that won't tell you which one. \r\n\r\nIf you *don't* catch the SyntaxError, you get the following additional info:\r\n\r\n```\r\n/home/vagrant/temp/testmodule.js:3\r\n});\r\n^\r\n```\r\n\r\nThis is super helpful (although it incorrectly contains some boilerplate - the `);` that doesn't actually exist in the file), and should be contained in the error's `message` and `stack` properties. At very least, the error object should contain those two pieces of information *somewhere*. \r\n"},"comment":{"url":"https://api.github.com/repos/nodejs/node/issues/comments/208940068","html_url":"https://github.com/nodejs/node/issues/3411#issuecomment-208940068","issue_url":"https://api.github.com/repos/nodejs/node/issues/3411","id":208940068,"user":{"login":"matthewloring","id":1485909,"avatar_url":"https://avatars.githubusercontent.com/u/1485909?v=3","gravatar_id":"","url":"https://api.github.com/users/matthewloring","html_url":"https://github.com/matthewloring","followers_url":"https://api.github.com/users/matthewloring/followers","following_url":"https://api.github.com/users/matthewloring/following{/other_user}","gists_url":"https://api.github.com/users/matthewloring/gists{/gist_id}","starred_url":"https://api.github.com/users/matthewloring/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matthewloring/subscriptions","organizations_url":"https://api.github.com/users/matthewloring/orgs","repos_url":"https://api.github.com/users/matthewloring/repos","events_url":"https://api.github.com/users/matthewloring/events{/privacy}","received_events_url":"https://api.github.com/users/matthewloring/received_events","type":"User","site_admin":false},"created_at":"2016-04-12T14:41:50Z","updated_at":"2016-04-12T14:41:50Z","body":"@fresheneesz This should be fixed by https://github.com/nodejs/node/pull/4874. Can you confirm this issue is fixed on master?"}}