Commit 188eec064c7916ed3055a2eee80f41aef2231364
1 parent
3d02a3eebf
Exists in
master
and in
1 other branch
Perbaikan coreapi
Showing 1 changed file with 3 additions and 3 deletions Side-by-side Diff
lib/coreapi.js
... | ... | @@ -30,7 +30,7 @@ function doRequest(params, cb) { |
30 | 30 | if (res.statusCode !== 200) { |
31 | 31 | logger.warn(`COREAPI: CORE returning HTTP STATUS CODE ${res.statusCode}, not 200`, { xid: params.xid, body }); |
32 | 32 | resolve(null); |
33 | - if (typeof cb === 'function') cb(err); | |
33 | + if (typeof cb === 'function') cb('NON_HTTP_STATUS_200'); | |
34 | 34 | return; |
35 | 35 | } |
36 | 36 | |
... | ... | @@ -40,12 +40,12 @@ function doRequest(params, cb) { |
40 | 40 | } catch (e) { |
41 | 41 | logger.verbose('COREAPI: CORE respond is not a JSON string'); |
42 | 42 | resolve(body); |
43 | - if (typeof cb === 'function') cb(err); | |
43 | + if (typeof cb === 'function') cb(e, body); | |
44 | 44 | return; |
45 | 45 | } |
46 | 46 | |
47 | 47 | resolve(bodyObject); |
48 | - if (typeof cb === 'function') cb(err); | |
48 | + if (typeof cb === 'function') cb(null, bodyObject); | |
49 | 49 | }); |
50 | 50 | }); |
51 | 51 | } |