mirror of
https://github.com/aspnet/JavaScriptServices.git
synced 2025-12-22 17:47:53 +00:00
Add exception stack to error response if available
This commit is contained in:
@@ -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;
|
||||||
|
|
||||||
|
if (errorValue.stack) {
|
||||||
|
res.end(errorValue.stack);
|
||||||
|
} else {
|
||||||
res.end(errorValue.toString());
|
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');
|
||||||
|
|||||||
Reference in New Issue
Block a user