kopia lustrzana https://github.com/c9/core
When we can't stringify the error log it and tell the user, don't send them a stack trace
rodzic
b2f6598e34
commit
9db5aff1c9
|
@ -120,6 +120,12 @@ function plugin(options, imports, register) {
|
|||
};
|
||||
|
||||
for (var prop in err) error[prop] = err[prop];
|
||||
try {
|
||||
JSON.stringify(error);
|
||||
} catch (e) {
|
||||
console.error("Cannot send error as JSON: ", error);
|
||||
error = "Unspecified error";
|
||||
}
|
||||
res.json({ error: error }, null, statusCode);
|
||||
// plain text
|
||||
} else {
|
||||
|
|
Ładowanie…
Reference in New Issue