diff options
Diffstat (limited to 'app/assets/javascripts/srp/src')
-rw-r--r-- | app/assets/javascripts/srp/src/jqueryRest.js | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/app/assets/javascripts/srp/src/jqueryRest.js b/app/assets/javascripts/srp/src/jqueryRest.js index 0c58eb2..437bd65 100644 --- a/app/assets/javascripts/srp/src/jqueryRest.js +++ b/app/assets/javascripts/srp/src/jqueryRest.js @@ -88,10 +88,17 @@ srp.remote = (function(){ // the http error response. function error(xhr, text, thrown) { - if (xhr.responseText && xhr.responseText != "") - srp.error($.parseJSON(xhr.responseText)); - else - srp.error("Server did not respond."); + var message; + if (xhr.responseText && xhr.responseText != "") { + try { + message = $.parseJSON(xhr.responseText); + } catch (err) { + message = xhr.responseText; + } + } else { + message = "Server did not respond."; + } + srp.error(message); }; return { |