log the first error that happens when loading a plugin fails

This commit is contained in:
soulgalore 2016-10-05 22:23:19 +02:00
parent 066cefe807
commit 5afb6e3064
1 changed files with 7 additions and 2 deletions

View File

@ -35,8 +35,13 @@ module.exports = {
try {
return require(path.join(pluginsDir, name));
} catch (err) {
// if it fails here, let it fail hard
return require(path.resolve(process.cwd(), name));
try {
return require(path.resolve(process.cwd(), name));
} catch(error) {
console.error('Couldn\'t load plugin %s: %s', name, err); // eslint-disable-line no-console
// if it fails here, let it fail hard
throw error;
}
}
});
}