admin管理员组

文章数量:1279120

I've found that when I have runtime errors (for example, reading an undefined property from an object) in a GET handler in express.js, Express is great at giving me feedback in the browser as to what the problem is and with a full stack trace.

However, when I have runtime errors as a result of an Ajax POST call, I don't get the same level of feedback and the Node console is sadly silent on the matter.

Is this an Express configuration issue?

I've found that when I have runtime errors (for example, reading an undefined property from an object) in a GET handler in express.js, Express is great at giving me feedback in the browser as to what the problem is and with a full stack trace.

However, when I have runtime errors as a result of an Ajax POST call, I don't get the same level of feedback and the Node console is sadly silent on the matter.

Is this an Express configuration issue?

Share Improve this question asked Nov 4, 2011 at 20:27 GregGreg 2,6095 gold badges31 silver badges46 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 12

Found the answer to my own questions...

You need to configure express's error handler to dump exceptions.

    app.use(express.errorHandler({showStack: true, dumpExceptions: true}));

本文标签: javascriptHow can I get expressjs to catch and report runtime exceptions in AJAX callsStack Overflow