Authored by htoooth

fix gitlab #1 . Add dispatch error try/catch and print error.

Showing 1 changed file with 8 additions and 1 deletions
... ... @@ -32,6 +32,9 @@ global.library = path.resolve('./library');
global.middleware = path.resolve('./doraemon/middleware');
global.utils = path.resolve('./utils');
// logger
const logger = require(global.library + '/logger');
// 向模板注入变量
app.locals.devEnv = app.get('env') === 'development';
app.locals.version = pkg.version;
... ... @@ -80,7 +83,11 @@ app.use((req, res, next) => {
app.use(seo());
// dispatcher
require('./dispatch')(app);
try {
require('./dispatch')(app);
} catch (e) {
logger.error(e);
}
// listener
app.listen(config.port, function() {
... ...