diff options
| author | Alon Levy <alon@pobox.com> | 2014-12-22 20:16:09 +0200 |
|---|---|---|
| committer | Alon Levy <alon@pobox.com> | 2014-12-22 20:16:09 +0200 |
| commit | 2c8855c1939e04813a07aedb13045ef39e857827 (patch) | |
| tree | 8d1a7d439df5a83501d96b6619eea7d388ad0253 /src/client | |
| parent | 79974686413c96e25e6bf46cf42051a0d81888c4 (diff) | |
client/rz_api_backend: report errors from rhizi, not just ajax errors
Diffstat (limited to 'src/client')
| -rw-r--r-- | src/client/rz_api_backend.js | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/client/rz_api_backend.js b/src/client/rz_api_backend.js index 76741533..e5288c64 100644 --- a/src/client/rz_api_backend.js +++ b/src/client/rz_api_backend.js @@ -24,11 +24,18 @@ define(['rz_config'], function(rz_config) { function on_success_wrapper(xhr, text) { // log wrap callback - var ret_data = xhr.data; - console.log('success: ' + JSON.stringify(ret_data)); - - if (on_success) { - on_success(ret_data); + var ret_data = xhr.data, + ret_error = xhr.error; + if (ret_error) { + console.log('ajax error: ' + JSON.stringify(ret_error)); + if (on_error) { + on_error(ret_error); + } + } else { + console.log('ajax success: ' + JSON.stringify(ret_data)); + if (on_success) { + on_success(ret_data); + } } } |
