Merge pull request #3580 from riking/patch-3

Add rudimentary HTTP error codes to ajax-error
This commit is contained in:
Robin Ward 2015-06-30 14:45:25 -04:00
commit ef81b8787e
1 changed files with 7 additions and 1 deletions

View File

@ -28,7 +28,7 @@ function extractError(error) {
if (parsedJSON) {
if (parsedJSON.errors && parsedJSON.errors.length > 0) {
parsedError = parsedJSON.errors[0];
parsedError = parsedJSON.errors.join("<br>");
} else if (parsedJSON.error) {
parsedError = parsedJSON.error;
} else if (parsedJSON.failed) {
@ -36,6 +36,12 @@ function extractError(error) {
}
}
if (!parsedError) {
if (error.status && error.status >= 400) {
parsedError = error.status + " " + error.statusText;
}
}
return parsedError || I18n.t('generic_error');
}