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});