Skip to content

Commit

Permalink
Merge pull request #1854 from adaptlearning/issue/1853
Browse files Browse the repository at this point in the history
Fix route error logging
  • Loading branch information
taylortom authored Mar 14, 2018
2 parents 703b7fd + 96d2fae commit 57df6ad
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@ Router.prototype.init = function (app) {
var route = require(itemPath);
server.use(route);
} catch(e) {
var detail = (e.code === 'MODULE_NOT_FOUND') ? ', no index.js found' : ` (${e})`;
logger.log('error', `Cannot load routes/${item}${detail}`);
// if the top-level module can't be loaded, it's the index.js
var detail = (e.message.indexOf(`'${itemPath}'`) === -1) ? e.message : 'no index.js found';
logger.log('error', `Cannot load routes/${item}, ${detail}`);
}
});
});
Expand Down

0 comments on commit 57df6ad

Please sign in to comment.