Better error message output

This commit is contained in:
Robin Ward 2014-12-01 14:53:03 -05:00
parent 6d0b6b0642
commit b547be44b2
1 changed files with 10 additions and 4 deletions

View File

@ -27,10 +27,16 @@ var ApplicationRoute = Discourse.Route.extend({
} }
var exceptionController = this.controllerFor('exception'), var exceptionController = this.controllerFor('exception'),
errorString = err.toString(); errorString = err.toString(),
if (err.statusText) { stack = err.stack;
errorString = err.statusText;
} // If we have a stack call `toString` on it. It gives us a better
// stack trace since `console.error` uses the stack track of this
// error callback rather than the original error.
if (stack) { errorString = stack.toString(); }
if (err.statusText) { errorString = err.statusText; }
var c = window.console; var c = window.console;
if (c && c.error) { if (c && c.error) {
c.error(errorString); c.error(errorString);