From 188eec064c7916ed3055a2eee80f41aef2231364 Mon Sep 17 00:00:00 2001
From: Adhidarma Hadiwinoto <me@adhisimon.org>
Date: Tue, 20 Aug 2019 12:09:55 +0700
Subject: [PATCH] Perbaikan coreapi

---
 lib/coreapi.js | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/coreapi.js b/lib/coreapi.js
index 4ec3401..0ab67e8 100644
--- a/lib/coreapi.js
+++ b/lib/coreapi.js
@@ -30,7 +30,7 @@ function doRequest(params, cb) {
             if (res.statusCode !== 200) {
                 logger.warn(`COREAPI: CORE returning HTTP STATUS CODE ${res.statusCode}, not 200`, { xid: params.xid, body });
                 resolve(null);
-                if (typeof cb === 'function') cb(err);
+                if (typeof cb === 'function') cb('NON_HTTP_STATUS_200');
                 return;
             }
 
@@ -40,12 +40,12 @@ function doRequest(params, cb) {
             } catch (e) {
                 logger.verbose('COREAPI: CORE respond is not a JSON string');
                 resolve(body);
-                if (typeof cb === 'function') cb(err);
+                if (typeof cb === 'function') cb(e, body);
                 return;
             }
 
             resolve(bodyObject);
-            if (typeof cb === 'function') cb(err);
+            if (typeof cb === 'function') cb(null, bodyObject);
         });
     });
 }
-- 
1.9.0