Commit cf07389090209ed6495478773c8e744c9b9de679

Authored by Adhidarma Hadiwinoto
1 parent 16d8ec8bba
Exists in master

simplifikasi topupRequest error

Showing 1 changed file with 9 additions and 9 deletions Side-by-side Diff

... ... @@ -106,18 +106,18 @@ function _topupRequest(task, pendingOnConnectError) {
106 106 client.methodCall(methodName, [ params ], function (error, value) {
107 107  
108 108 // Results of the method response
109   - if (error && !pendingOnConnectError && (error.code == 'ECONNREFUSED' || error.code == 'EHOSTUNREACH')) {
110 109  
111   - logger.warn('XMLRPC Client Error on connecting', {requestId: task['requestId'], err: error});
112   - callbackReport(task['requestId'], '91', 'Gangguan koneksi ke suplier: ' + error);
113   - return;
114   -
115   - } else if (error) {
  110 + if (error) {
  111 + var rc = '68';
  112 + var msg = 'XMLRPC Client Error: ' + error;
  113 +
  114 + if (!pendingOnConnectError && (error.code == 'ECONNREFUSED' || error.code == 'EHOSTUNREACH')) {
  115 + rc = '91';
  116 + msg = 'XMLRPC Client Error on connecting';
  117 + }
116 118  
117   - logger.warn('XMLRPC Client Error', {requestId: task['requestId'], err: error});
118   - callbackReport(task['requestId'], '68', 'XMLRPC Client Error: ' + error, null, error.body);
  119 + callbackReport(task['requestId'], rc, msg, null, JSON.stringify(error));
119 120 return;
120   -
121 121 }
122 122  
123 123 logger.info('Got XMLRPC response from partner for', {response_method: methodName, response_message: value});