UNPKG

greenhorn

Version:

A simple server that renders HTML using various engines and a configuration file with test data

26 lines (20 loc) 440 B
var debug = require('./debug'); module.exports = tryRequire; function tryRequire(module) { var m; debug('%s : trying to load module', module); try { m = require(module); } catch (e) { if (e.code === 'MODULE_NOT_FOUND') { debug('%s : module not found', module); } else { //if the error is something other than MODULE_NOT_FOUND //then we should throw it throw e; } } return m; }