【发布时间】:2012-03-12 07:42:18
【问题描述】:
我正在使用 expressjs
我这样创建应用程序:
app.createServer(
express.cookieParser(),
express.bodyParser(),
myfunc1(),
myfunc2()
);
在 myfunc1 中,我在某些情况下返回 next(err)。 (例如 req.query 包含一些奇怪的字符)。
所以,如果发生这种情况( next(err) ),它只是简单地返回 http 响应 500。我尝试使用以下方法捕获错误:
app.error(....) or
process.on("uncaughtexception" ... );
但错误并没有发生在这两个方面。他哪里出错了?
【问题讨论】:
-
app.error(...);使用的代码是什么?我很确定这是正确的做法。
标签: exception node.js error-handling express