Skip to content

Commit

Permalink
fix: better error reporting when loading plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
vojtajina committed Apr 13, 2013
1 parent 3034bcf commit d9078a8
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lib/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,16 @@ exports.start = function(cliOptions, done) {
// register all plugins
config.plugins.forEach(function(plugin) {
if (helper.isString(plugin)) {
modules.push(require(plugin));
try {
modules.push(require(plugin));
} catch (e) {
if (e.code === 'MODULE_NOT_FOUND') {
log.warn('Cannot find plugin "%s".\n Did you forget to install it ?\n' +
' npm install %s --save-dev', plugin, plugin);
} else {
log.warn('Error during loading "%s" plugin:\n %s', plugin, e.message);
}
}
} else if (helper.isObject(plugin)) {
modules.push(plugin);
} else {
Expand Down

0 comments on commit d9078a8

Please sign in to comment.