{"action":"created","issue":{"url":"https://api.github.com/repos/ember-cli/ember-cli/issues/5315","labels_url":"https://api.github.com/repos/ember-cli/ember-cli/issues/5315/labels{/name}","comments_url":"https://api.github.com/repos/ember-cli/ember-cli/issues/5315/comments","events_url":"https://api.github.com/repos/ember-cli/ember-cli/issues/5315/events","html_url":"https://github.com/ember-cli/ember-cli/pull/5315","id":125557143,"number":5315,"title":"Wrapped error prone require in try/catch block","user":{"login":"mozeryansky","id":3287719,"avatar_url":"https://avatars.githubusercontent.com/u/3287719?v=3","gravatar_id":"","url":"https://api.github.com/users/mozeryansky","html_url":"https://github.com/mozeryansky","followers_url":"https://api.github.com/users/mozeryansky/followers","following_url":"https://api.github.com/users/mozeryansky/following{/other_user}","gists_url":"https://api.github.com/users/mozeryansky/gists{/gist_id}","starred_url":"https://api.github.com/users/mozeryansky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozeryansky/subscriptions","organizations_url":"https://api.github.com/users/mozeryansky/orgs","repos_url":"https://api.github.com/users/mozeryansky/repos","events_url":"https://api.github.com/users/mozeryansky/events{/privacy}","received_events_url":"https://api.github.com/users/mozeryansky/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-01-08T07:22:33Z","updated_at":"2016-01-08T07:31:30Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/ember-cli/ember-cli/pulls/5315","html_url":"https://github.com/ember-cli/ember-cli/pull/5315","diff_url":"https://github.com/ember-cli/ember-cli/pull/5315.diff","patch_url":"https://github.com/ember-cli/ember-cli/pull/5315.patch"},"body":"Because the build file is user editable, it presents the possibility of a user introducing invalid javascript, which causes `require` to throw an error.\r\n\r\nI would like the error message to be more descriptive, but I couldn't get any more information from the exception require() threw.\r\n\r\nAlso I was debating whether to use the full path, `buildFilePath`, or just the file name, `file`.\r\n\r\nI encountered this because I forgot a comma, and `ember s` returned this error:\r\n```\r\nUnexpected string\r\nSyntaxError: Unexpected string\r\n    at exports.runInThisContext (vm.js:53:16)\r\n    at Module._compile (module.js:374:25)\r\n    at Object.Module._extensions..js (module.js:405:10)\r\n    at Module.load (module.js:344:32)\r\n    at Function.Module._load (module.js:301:12)\r\n    at Module.require (module.js:354:17)\r\n    at require (internal/module.js:12:17)\r\n    at module.exports (/Users/michael/Sites/myemberapp/node_modules/ember-cli/lib/utilities/find-build-file.js:20:21)\r\n    at Class.module.exports.Task.extend.setupBroccoliBuilder (/Users/michael/Sites/myemberapp/node_modules/ember-cli/lib/models/builder.js:49:21)\r\n    at Class.module.exports.Task.extend.init (/Users/michael/Sites/myemberapp/node_modules/ember-cli/lib/models/builder.js:89:10)\r\n```\r\nWhich this makes no sense.\r\n\r\nNow the error message will be:\r\n```\r\nSyntaxError: could not require \"ember-cli-build.js\": Unexpected string\r\nError: SyntaxError: could not require \"ember-cli-build.js\": Unexpected string\r\n    at module.exports (/Users/michael/Sites/myemberapp/node_modules/ember-cli/lib/utilities/find-build-file.js:24:8)\r\n    at Class.module.exports.Task.extend.setupBroccoliBuilder (/Users/michael/Sites/myemberapp/node_modules/ember-cli/lib/models/builder.js:49:21)\r\n    at Class.module.exports.Task.extend.init (/Users/michael/Sites/myemberapp/node_modules/ember-cli/lib/models/builder.js:89:10)\r\n    at new Class (/Users/michael/Sites/myemberapp/node_modules/ember-cli/node_modules/core-object/core-object.js:18:12)\r\n    at Class.module.exports.Task.extend.run (/Users/michael/Sites/myemberapp/node_modules/ember-cli/lib/tasks/serve.js:15:19)\r\n    at /Users/michael/Sites/myemberapp/node_modules/ember-cli/lib/commands/serve.js:70:22\r\n    at lib$rsvp$$internal$$tryCatch (/Users/michael/Sites/myemberapp/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:493:16)\r\n    at lib$rsvp$$internal$$invokeCallback (/Users/michael/Sites/myemberapp/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:505:17)\r\n    at /Users/michael/Sites/myemberapp/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:1001:13\r\n    at lib$rsvp$asap$$flush (/Users/michael/Sites/myemberapp/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:1198:9)\r\n```\r\n\r\nWhile the stack trace doesn't help the user, at least I know the error is in `ember-cli-build.js`."},"comment":{"url":"https://api.github.com/repos/ember-cli/ember-cli/issues/comments/169917783","html_url":"https://github.com/ember-cli/ember-cli/pull/5315#issuecomment-169917783","issue_url":"https://api.github.com/repos/ember-cli/ember-cli/issues/5315","id":169917783,"user":{"login":"stefanpenner","id":1377,"avatar_url":"https://avatars.githubusercontent.com/u/1377?v=3","gravatar_id":"","url":"https://api.github.com/users/stefanpenner","html_url":"https://github.com/stefanpenner","followers_url":"https://api.github.com/users/stefanpenner/followers","following_url":"https://api.github.com/users/stefanpenner/following{/other_user}","gists_url":"https://api.github.com/users/stefanpenner/gists{/gist_id}","starred_url":"https://api.github.com/users/stefanpenner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stefanpenner/subscriptions","organizations_url":"https://api.github.com/users/stefanpenner/orgs","repos_url":"https://api.github.com/users/stefanpenner/repos","events_url":"https://api.github.com/users/stefanpenner/events{/privacy}","received_events_url":"https://api.github.com/users/stefanpenner/received_events","type":"User","site_admin":false},"created_at":"2016-01-08T07:31:30Z","updated_at":"2016-01-08T07:31:30Z","body":"SG, but will need a test."}}