Bot stops crash when lost connection with peatio

Issue #102 resolved
Desrever Nu created an issue

a possible solution is putting the following instruction

#!        
java

JSONObject response = JSON.parseObject(queryResult);

into a try block to catch its exception

Exception in thread "Strategy Crypto Task" com.alibaba.fastjson.JSONException: syntax error, pos 1
    at com.alibaba.fastjson.parser.DefaultJSONParser.parse(DefaultJSONParser.java:1240)
    at com.alibaba.fastjson.parser.DefaultJSONParser.parse(DefaultJSONParser.java:1153)
    at com.alibaba.fastjson.JSON.parse(JSON.java:102)
    at com.alibaba.fastjson.JSON.parse(JSON.java:93)
    at com.alibaba.fastjson.JSON.parseObject(JSON.java:164)
    at com.nubits.nubot.trading.wrappers.PeatioWrapper.getBalanceImpl(PeatioWrapper.java:173)
    at com.nubits.nubot.trading.wrappers.PeatioWrapper.getAvailableBalances(PeatioWrapper.java:145)
    at com.nubits.nubot.tasks.StrategySecondaryPegTask.recount(StrategySecondaryPegTask.java:383)
    at com.nubits.nubot.tasks.StrategySecondaryPegTask.run(StrategySecondaryPegTask.java:61)
    at java.util.TimerThread.mainLoop(Timer.java:555)
    at java.util.TimerThread.run(Timer.java:505)

Comments (5)

  1. Sam Griffiths

    Only the Peatio (and hence BitSpark) wrappers were affected by this. They used the alibaba json parser which doesn't have a native exception. All other wrappers use the simple-Json parser which has a parser exception correctly implemented. I have updated the peatio and bitspark wrappers to use simple-JSON in line with the other wrappers.

  2. Log in to comment