diff options
author | Marek Kotewicz <marek.kotewicz@gmail.com> | 2014-11-07 21:03:46 +0800 |
---|---|---|
committer | Marek Kotewicz <marek.kotewicz@gmail.com> | 2014-11-07 21:03:46 +0800 |
commit | 0d6479e1d63598baed0b0c41d4dd8ff9f7ecc449 (patch) | |
tree | 638907e31c292bea4210b484cea64d7f91d1605c /httprpc.js | |
parent | b0e11826e5f5e73f37304365fbaf504ed53d7886 (diff) | |
download | dexon-0d6479e1d63598baed0b0c41d4dd8ff9f7ecc449.tar dexon-0d6479e1d63598baed0b0c41d4dd8ff9f7ecc449.tar.gz dexon-0d6479e1d63598baed0b0c41d4dd8ff9f7ecc449.tar.bz2 dexon-0d6479e1d63598baed0b0c41d4dd8ff9f7ecc449.tar.lz dexon-0d6479e1d63598baed0b0c41d4dd8ff9f7ecc449.tar.xz dexon-0d6479e1d63598baed0b0c41d4dd8ff9f7ecc449.tar.zst dexon-0d6479e1d63598baed0b0c41d4dd8ff9f7ecc449.zip |
proper error handling proposal
Diffstat (limited to 'httprpc.js')
-rw-r--r-- | httprpc.js | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/httprpc.js b/httprpc.js index ef29133e8..e738e1f0f 100644 --- a/httprpc.js +++ b/httprpc.js @@ -40,7 +40,8 @@ return { _id: object.id, - data: object.result + data: object.result, + error: object.error }; }; @@ -70,7 +71,7 @@ var self = this; this.sendRequest(payload, function (request) { var parsed = JSON.parse(request.responseText); - if (parsed.result instanceof Array ? parsed.result.length === 0 : !parsed.result) { + if (parsed.error || (parsed.result instanceof Array ? parsed.result.length === 0 : !parsed.result)) { return; } self.handlers.forEach(function (handler) { |