From cf07389090209ed6495478773c8e744c9b9de679 Mon Sep 17 00:00:00 2001 From: Adhidarma Hadiwinoto <me@adhisimon.org> Date: Mon, 22 Aug 2016 17:30:32 +0700 Subject: [PATCH] simplifikasi topupRequest error --- xmlout.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/xmlout.js b/xmlout.js index 79a0747..0fe7634 100644 --- a/xmlout.js +++ b/xmlout.js @@ -106,18 +106,18 @@ function _topupRequest(task, pendingOnConnectError) { client.methodCall(methodName, [ params ], function (error, value) { // Results of the method response - if (error && !pendingOnConnectError && (error.code == 'ECONNREFUSED' || error.code == 'EHOSTUNREACH')) { - logger.warn('XMLRPC Client Error on connecting', {requestId: task['requestId'], err: error}); - callbackReport(task['requestId'], '91', 'Gangguan koneksi ke suplier: ' + error); - return; - - } else if (error) { + if (error) { + var rc = '68'; + var msg = 'XMLRPC Client Error: ' + error; + + if (!pendingOnConnectError && (error.code == 'ECONNREFUSED' || error.code == 'EHOSTUNREACH')) { + rc = '91'; + msg = 'XMLRPC Client Error on connecting'; + } - logger.warn('XMLRPC Client Error', {requestId: task['requestId'], err: error}); - callbackReport(task['requestId'], '68', 'XMLRPC Client Error: ' + error, null, error.body); + callbackReport(task['requestId'], rc, msg, null, JSON.stringify(error)); return; - } logger.info('Got XMLRPC response from partner for', {response_method: methodName, response_message: value}); -- 1.9.0