mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-24 14:43:08 +03:00
Improve error message
closes #600 - replaced '?' with 'Server was not available' - added request.statusText
This commit is contained in:
parent
881e861295
commit
d5b197656b
@ -81,7 +81,8 @@
|
|||||||
// Used in API request fail handlers to parse a standard api error
|
// Used in API request fail handlers to parse a standard api error
|
||||||
// response json for the message to display
|
// response json for the message to display
|
||||||
getRequestErrorMessage: function (request) {
|
getRequestErrorMessage: function (request) {
|
||||||
var message;
|
var message,
|
||||||
|
msgDetail;
|
||||||
|
|
||||||
// Can't really continue without a request
|
// Can't really continue without a request
|
||||||
if (!request) {
|
if (!request) {
|
||||||
@ -97,7 +98,8 @@
|
|||||||
// Try to parse out the error, or default to "Unknown"
|
// Try to parse out the error, or default to "Unknown"
|
||||||
message = request.responseJSON.error || "Unknown Error";
|
message = request.responseJSON.error || "Unknown Error";
|
||||||
} catch (e) {
|
} 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 + ").";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user