How to code for automatic restart when a robot reports an error

Author: Don't eat spinach, Created: 2018-03-12 19:23:01, Updated:

Please teach me, God. How can the code be used to automatically restart a robot when it reports a bug? You can also manually restart the device by sending a WeChat message to alert you to an error. Thank you!img


More

The Little Dream- 1, use exception handling.Throw "error", push messages when an exception is captured, Log (("XXX", "@") - 2, BotVS extended API, detected bot status, stopped and restarted However, it is not recommended to do this, because your TypeError, as shown above, is a policy or programming problem that must be addressed.

The Little DreamIf you don't need to extend API controls, then the exception mechanism for using JS is try{...} catch(e) {...} so as to find errors. It is recommended that the data returned by the exchange API be dealt with in an error-free manner. What's up? var ticker = exchange.GetTicker ((() // If an exception occurs for various reasons that cause GetTicker to return null. If the ticker is null. // try again I'm not sure. What's up?

Don't eat spinachThis attribute is returned by the exchange's API, not defined by me, but every once in a while the exchange has data anomalies that cause the attribute to be unreadable, and then the robot stops automatically.

The Little DreamThis error You check the currentQty property should be a variable of undefined type, then visit the currentQty of this variable, focus on the.currentQty code, and see if the previous variable is possible to be undefined.

Don't eat spinachI don't know if it's a design problem, BitMEX is running and running and after a while (about 4 hours or so) it throws an error and has to be restarted manually.