From d9078a8eca41df15f26b53e2375f722a48d0992d Mon Sep 17 00:00:00 2001 From: Vojta Jina Date: Fri, 12 Apr 2013 20:44:17 -0700 Subject: [PATCH] fix: better error reporting when loading plugins --- lib/server.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/server.js b/lib/server.js index f8dae3f7e..d3dba8c7e 100644 --- a/lib/server.js +++ b/lib/server.js @@ -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 {