Ale*_*lex 6 error-handling node.js express
我正在开发一个快速应用程序.
我目前在server.js中有以下内容
process.on('uncaughtException', function (err) {
    console.log( "UNCAUGHT EXCEPTION " );
    console.log( "[Inside 'uncaughtException' event] " + err.stack || err.message );
});
每当出现错误时停止服务器崩溃,但是,它只是坐在那里......
是否可以代替console.log,发送包含错误详细信息的500错误页面?
我不认为你可以从uncaughtException做出回应,因为即使没有请求发生也可能发生.
app.error(function(err, req, res, next){
    //check error information and respond accordingly
});
| 归档时间: | 
 | 
| 查看次数: | 6293 次 | 
| 最近记录: |