From d2f8b8de1f40c439321ceb7fffd39d8ab998cfc5 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Mon, 2 Jul 2018 13:15:19 +0200 Subject: [PATCH] Case when there are not enough funds --- PoloniexAPIClient.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/PoloniexAPIClient.js b/PoloniexAPIClient.js index 8eccf9526..12bbe0fd4 100644 --- a/PoloniexAPIClient.js +++ b/PoloniexAPIClient.js @@ -441,7 +441,22 @@ logger.write(MODULE_NAME, "[ERROR] analizeResponse -> exchangeErr = " + exchangeErr); logger.write(MODULE_NAME, "[ERROR] analizeResponse -> exchangeResponse = " + exchangeResponse); - notOkCallBack(global.DEFAULT_FAIL_RESPONSE); + /* {"error":"Not enough USDT.","success":0}*/ + + if (JSON.stringify(exchangeResponse).indexOf("Not enough") > 0) { + + let err = { + resutl: global.CUSTOM_FAIL_RESPONSE.result, + message: exchangeResponse.error + }; + + notOkCallBack(err); + + } else { + + notOkCallBack(global.DEFAULT_FAIL_RESPONSE); + + } return; }