More specific log message for missing HTTP API

This commit is contained in:
Andrew Stewart 2015-01-13 10:13:16 -08:00
parent 6e830bee34
commit b72864ca75
1 changed files with 14 additions and 4 deletions

View File

@ -89,11 +89,21 @@ Cylon.api = function api(Server, opts) {
Server = require(req);
} catch (e) {
if (e.code === "MODULE_NOT_FOUND") {
Logger.error("Cannot find the " + req + " API module.");
Logger.error(
"You may be able to install it: `npm install " + req + "`"
);
var messages;
if (req === "cylon-api-http") {
messages = [
"The HTTP API is no longer included in Cylon by default.",
"To use it, install the plugin module: `npm install cylon-api-http`"
];
} else {
messages = [
"Cannot find the " + req + " API module.",
"You may be able to install it: `npm install " + req + "`"
];
}
_.each(messages, function(str) { Logger.error(str); });
return;
} else {
throw e;