From 1845494ef269013b81b9f0e8ef44e4ec4849e1cd Mon Sep 17 00:00:00 2001 From: LV-426 Date: Mon, 30 Mar 2015 20:43:03 +0300 Subject: rz_api_backend: expect ajax errors to be server with non 200 HTTP status --- src/client/rz_api_backend.js | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/client/rz_api_backend.js b/src/client/rz_api_backend.js index 76f65fe7..79b8ab89 100644 --- a/src/client/rz_api_backend.js +++ b/src/client/rz_api_backend.js @@ -39,19 +39,14 @@ define(['model/core'], function(model_core) { function on_success_wrapper(xhr, text) { // log wrap callback - 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: ' + shorten(JSON.stringify(ret_data), 50)); - if (on_success) { - on_success(ret_data); - } - } + var ret_data = xhr.data; + util.assert(undefined == xhr.error); // assert we no longer return errors along with HTTP 200 status codes + + console.log('ajax success: return value:'); + console.dir(ret_data); + if (on_success) { + on_success(ret_data); + }; } /* -- cgit v1.3.1