express
express copied to clipboard
next()ing an error with json content type wont return formatted error
jQuery $.ajax({url:"http://localhost:3000/nodeapi/error", dataType:'json'})
Express app.get('/error', function(req, res, next) { next(new Error('my custom error')) })
Will produce {"error":{}}
In development mode only.
It appears the line 78 of errorHandler.js does the following.
var json = JSON.stringify({ error: err });
Try the following in a browser to see the same problem JSON.stringify(new Error('test'))
Cheers,
Tim
yeah the v8 update in 0.6.x makes the error properties non-enumerable, this is fixed however I need to release
This issue has been inactive for over 4 months so I'm closing it. If you think it's still an issue re-open.
- tjbot