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

checkInputPathsExist errors are unhelpful #438

Open
rwjblue opened this issue Oct 2, 2019 · 0 comments
Open

checkInputPathsExist errors are unhelpful #438

rwjblue opened this issue Oct 2, 2019 · 0 comments
Labels

Comments

@rwjblue
Copy link
Member

rwjblue commented Oct 2, 2019

When you have either a WatchedDir or plain string as an input node for a plugin and that directory does not exist we throw an error here:

broccoli/lib/builder.js

Lines 270 to 283 in b684378

checkInputPathsExist() {
// We might consider checking this.unwatchedPaths as well.
for (let i = 0; i < this.watchedPaths.length; i++) {
let isDirectory;
try {
isDirectory = fs.statSync(this.watchedPaths[i]).isDirectory();
} catch (err) {
throw new this.constructor.BuilderError('Directory not found: ' + this.watchedPaths[i]);
}
if (!isDirectory) {
throw new this.constructor.BuilderError('Not a directory: ' + this.watchedPaths[i]);
}
}
}

Unfortunately, that error message is pretty useless:

  BuilderError: Directory not found: addon/styles
    at Builder.checkInputPathsExist (/Users/rjackson/sandbox/zenunu/node_modules/broccoli/dist/builder.js:241:23)
    at new Builder (/Users/rjackson/sandbox/zenunu/node_modules/broccoli/dist/builder.js:58:14)
    at Builder.setupBroccoliBuilder (/Users/rjackson/sandbox/zenunu/node_modules/ember-cli/lib/models/builder.js:84:22)
    at new Builder (/Users/rjackson/sandbox/zenunu/node_modules/ember-cli/lib/models/builder.js:32:10)
    at BuildTask.run (/Users/rjackson/sandbox/zenunu/node_modules/ember-cli/lib/tasks/build.js:15:19)
    at Promise.resolve.then (/Users/rjackson/sandbox/zenunu/node_modules/ember-cli/lib/models/command.js:239:24)
    at tryCatcher (/Users/rjackson/sandbox/zenunu/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:326:21)
    at invokeCallback (/Users/rjackson/sandbox/zenunu/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:498:33)
    at /Users/rjackson/sandbox/zenunu/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:562:16
    at flush (/Users/rjackson/sandbox/zenunu/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:2441:7)
    at process._tickCallback (internal/process/next_tick.js:61:11)
    at Function.Module.runMain (internal/modules/cjs/loader.js:834:11)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)

In order to make it useful, we should throw it during the makeNodeWrapper recursion and include the parent node's annotation (or constructor.name).

@rwjblue rwjblue added the bug label Oct 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant