Add exception stack to error response if available

This commit is contained in:
Greg Beaty
2015-12-09 16:36:30 -05:00
parent bc359a3a4b
commit 1e446b6797

View File

@@ -21,7 +21,12 @@ var server = http.createServer(function(req, res) {
hasSentResult = true; hasSentResult = true;
if (errorValue) { if (errorValue) {
res.statusCode = 500; res.statusCode = 500;
res.end(errorValue.toString());
if (errorValue.stack) {
res.end(errorValue.stack);
} else {
res.end(errorValue.toString());
}
} else if (typeof successValue !== 'string') { } else if (typeof successValue !== 'string') {
// Arbitrary object/number/etc - JSON-serialize it // Arbitrary object/number/etc - JSON-serialize it
res.setHeader('Content-Type', 'application/json'); res.setHeader('Content-Type', 'application/json');