【发布时间】:2015-09-21 08:35:12
【问题描述】:
假设我已经定义了以下 restify 端点:
server.get('/test/1', function (req, res, next) {
undefinedFunctionCall(); // Will cause exception
return next();
}
如何在我的服务器控制台中获取堆栈跟踪,告诉我undefinedFunctionCall 未定义? client 得到它但不是服务器。
我在the docs 中读到,您可以收听事件InternalServerError 和InternalError,但在我测试时没有发生火灾。我必须做什么?
代码:
server.on('InternalServerError', function (req, res, err, cb) {
console.log('INTERNAL ERROR!'); // Never executed
return cb();
});
我在 Windows 10 的节点 0.10.33 上运行 Restify 4.0.0
【问题讨论】: