From d5b197656bc4d642d83fe9dfcbfe03a8ce8c30b6 Mon Sep 17 00:00:00 2001 From: Sebastian Gierlinger Date: Mon, 16 Sep 2013 10:16:42 +0200 Subject: [PATCH] Improve error message closes #600 - replaced '?' with 'Server was not available' - added request.statusText --- core/client/views/base.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/client/views/base.js b/core/client/views/base.js index fca4343bb2..59f6d217f8 100644 --- a/core/client/views/base.js +++ b/core/client/views/base.js @@ -81,7 +81,8 @@ // Used in API request fail handlers to parse a standard api error // response json for the message to display getRequestErrorMessage: function (request) { - var message; + var message, + msgDetail; // Can't really continue without a request if (!request) { @@ -97,7 +98,8 @@ // Try to parse out the error, or default to "Unknown" message = request.responseJSON.error || "Unknown Error"; } catch (e) { - message = "The server returned an error (" + (request.status || "?") + ")."; + msgDetail = request.status ? request.status + " - " + request.statusText : "Server was not available"; + message = "The server returned an error (" + msgDetail + ")."; } }