Show file/line from a "[timestamp] TypeError: .."
Show file/line from a "[timestamp] TypeError: .."
有时我的 API 在 node.js 中抛出一个(例如)
// Forever error log
[2015-05-20 08:07:48] TypeError: Cannot read property 'length' of undefined
如你所见,我不知道它来自哪里,有什么方法可以获取该信息吗?
我修复了向 app.js
添加错误处理程序的问题
process.on('uncaughtException', function(err) {
// Log the error as you want
log(err.stack || err.message, 'error');
});
有关使用 expressjs 进行错误处理的更多信息:http://expressjs.com/guide/error-handling.html
有时我的 API 在 node.js 中抛出一个(例如)
// Forever error log
[2015-05-20 08:07:48] TypeError: Cannot read property 'length' of undefined
如你所见,我不知道它来自哪里,有什么方法可以获取该信息吗?
我修复了向 app.js
添加错误处理程序的问题process.on('uncaughtException', function(err) {
// Log the error as you want
log(err.stack || err.message, 'error');
});
有关使用 expressjs 进行错误处理的更多信息:http://expressjs.com/guide/error-handling.html