Created
June 9, 2014 20:42
-
-
Save shindakun/4fbdcc581d0a6dd9da03 to your computer and use it in GitHub Desktop.
showerror
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
showAPIError: function (resp, defaultErrorText) { | |
defaultErrorText = defaultErrorText || 'There was a problem on the server, please try again.'; | |
if (resp && resp.jqXHR && resp.jqXHR.responseJSON && resp.jqXHR.responseJSON.error) { | |
this.showError(resp.jqXHR.responseJSON.error); | |
} else if (resp && resp.jqXHR && resp.jqXHR.responseJSON && resp.jqXHR.responseJSON.errors) { | |
for (var i = 0; i < resp.jqXHR.responseJSON.errors.length; i += 1) { | |
this.showError(resp.jqXHR.responseJSON.errors[i].message); | |
} | |
} else { | |
this.showError(defaultErrorText); | |
} | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment