diff options
| author | LV-426 <lv-426@taproot.org.il> | 2015-03-30 20:44:59 +0300 |
|---|---|---|
| committer | LV-426 <lv-426@taproot.org.il> | 2015-04-01 22:25:54 +0300 |
| commit | a0f15c8b73c93681dd5a4b02950d3b644199783b (patch) | |
| tree | 3a9df8bc46feff647a0b8632ff8c2f1293ea96f1 | |
| parent | f2f0f2879a87a6bec5f6892c468b0dccfa9ac7bc (diff) | |
rz_api_backend: ajax_rs(): use xhr.responseJSON.error as error msg
| -rw-r--r-- | src/client/rz_api_backend.js | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/client/rz_api_backend.js b/src/client/rz_api_backend.js index 1d23633e..12bf8d45 100644 --- a/src/client/rz_api_backend.js +++ b/src/client/rz_api_backend.js @@ -29,11 +29,12 @@ define(['model/core'], function(model_core) { */ var ajax_rs = function(path, req_opts, on_success, on_error) { - function on_error_wrapper(xhr, err_text, err_thrown) { + function on_error_wrapper(xhr, text_status, err_thrown) { // log wrap callback - console.error('error: \'' + err_text + '\''); + var err_msg = xhr.responseJSON && xhr.responseJSON.error; + console.error(text_status + ': ' + err_msg); if (on_error && typeof (on_error) === "function") { - on_error(err_text); + on_error(err_msg); } } |
