Skip to content
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

Pr 5315 #5396

Merged
merged 5 commits into from Jan 27, 2016
Merged

Pr 5315 #5396

merged 5 commits into from Jan 27, 2016

Conversation

stefanpenner
Copy link
Contributor

No description provided.

mozeryansky and others added 5 commits January 8, 2016 02:22
Because the build file is user editable, it presents the possibility of a user introducing invalid javascript, which causes `require` to throw an error.

I would like the error message to be more descriptive, but I couldn't get any more information from the exception require() threw.

Also I was debating whether to use the full path, `buildFilePath`, or just the file name, `file`.

I encountered this because I forgot a comma, and `ember s` returned this error:
```
Unexpected string
SyntaxError: Unexpected string
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:374:25)
    at Object.Module._extensions..js (module.js:405:10)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)
    at Module.require (module.js:354:17)
    at require (internal/module.js:12:17)
    at module.exports (/Users/michael/Sites/myemberapp/node_modules/ember-cli/lib/utilities/find-build-file.js:20:21)
    at Class.module.exports.Task.extend.setupBroccoliBuilder (/Users/michael/Sites/myemberapp/node_modules/ember-cli/lib/models/builder.js:49:21)
    at Class.module.exports.Task.extend.init (/Users/michael/Sites/myemberapp/node_modules/ember-cli/lib/models/builder.js:89:10)
```
Which this makes no sense.

Now the error message will be:
```
Error: could not require "ember-cli-build.js": Unexpected string
Error: Error: could not require "ember-cli-build.js": Unexpected string
    at module.exports (/Users/michael/Sites/myemberapp/node_modules/ember-cli/lib/utilities/find-build-file.js:24:8)
    at Class.module.exports.Task.extend.setupBroccoliBuilder (/Users/michael/Sites/myemberapp/node_modules/ember-cli/lib/models/builder.js:49:21)
    at Class.module.exports.Task.extend.init (/Users/michael/Sites/myemberapp/node_modules/ember-cli/lib/models/builder.js:89:10)
    at new Class (/Users/michael/Sites/myemberapp/node_modules/ember-cli/node_modules/core-object/core-object.js:18:12)
    at Class.module.exports.Task.extend.run (/Users/michael/Sites/myemberapp/node_modules/ember-cli/lib/tasks/serve.js:15:19)
    at /Users/michael/Sites/myemberapp/node_modules/ember-cli/lib/commands/serve.js:70:22
    at lib$rsvp$$internal$$tryCatch (/Users/michael/Sites/myemberapp/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:493:16)
    at lib$rsvp$$internal$$invokeCallback (/Users/michael/Sites/myemberapp/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:505:17)
    at /Users/michael/Sites/myemberapp/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:1001:13
    at lib$rsvp$asap$$flush (/Users/michael/Sites/myemberapp/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:1198:9)
```

While the stack trace doesn't help the user, at least I know the error is in `ember-cli-build.js`.
Using regex since Node versions output different error messages.

Error thrown maintains error type, only modifies the message.
@stefanpenner
Copy link
Contributor Author

@homu r+

@homu
Copy link
Contributor

homu commented Jan 26, 2016

📌 Commit cc2bc3d has been approved by stefanpenner

@homu
Copy link
Contributor

homu commented Jan 26, 2016

⌛ Testing commit cc2bc3d with merge 5813231...

homu added a commit that referenced this pull request Jan 26, 2016
@homu
Copy link
Contributor

homu commented Jan 26, 2016

💔 Test failed - status

@stefanpenner
Copy link
Contributor Author

@homu retry

@homu
Copy link
Contributor

homu commented Jan 27, 2016

⌛ Testing commit cc2bc3d with merge e642886...

homu added a commit that referenced this pull request Jan 27, 2016
@homu
Copy link
Contributor

homu commented Jan 27, 2016

☀️ Test successful - status

@homu homu merged commit cc2bc3d into master Jan 27, 2016
@rwjblue rwjblue deleted the pr-5315 branch February 4, 2016 21:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants