[Mod] no throw when RestClient catches exception, only write log message
This commit is contained in:
parent
81c7e105ab
commit
15de4c1e1b
@ -752,6 +752,19 @@ class HbdmRestApi(RestClient):
|
|||||||
if not issubclass(exception_type, ConnectionError):
|
if not issubclass(exception_type, ConnectionError):
|
||||||
self.on_error(exception_type, exception_value, tb, request)
|
self.on_error(exception_type, exception_value, tb, request)
|
||||||
|
|
||||||
|
def on_error(
|
||||||
|
self, exception_type: type, exception_value: Exception, tb, request: Request
|
||||||
|
):
|
||||||
|
"""
|
||||||
|
Callback to handler request exception.
|
||||||
|
"""
|
||||||
|
msg = f"触发异常,状态码:{exception_type},信息:{exception_value}"
|
||||||
|
self.gateway.write_log(msg)
|
||||||
|
|
||||||
|
sys.stderr.write(
|
||||||
|
self.exception_detail(exception_type, exception_value, tb, request)
|
||||||
|
)
|
||||||
|
|
||||||
def check_error(self, data: dict, func: str = ""):
|
def check_error(self, data: dict, func: str = ""):
|
||||||
""""""
|
""""""
|
||||||
if data["status"] != "error":
|
if data["status"] != "error":
|
||||||
|
@ -441,6 +441,19 @@ class HuobiRestApi(RestClient):
|
|||||||
|
|
||||||
self.order_manager.on_order(order)
|
self.order_manager.on_order(order)
|
||||||
|
|
||||||
|
def on_error(
|
||||||
|
self, exception_type: type, exception_value: Exception, tb, request: Request
|
||||||
|
):
|
||||||
|
"""
|
||||||
|
Callback to handler request exception.
|
||||||
|
"""
|
||||||
|
msg = f"触发异常,状态码:{exception_type},信息:{exception_value}"
|
||||||
|
self.gateway.write_log(msg)
|
||||||
|
|
||||||
|
sys.stderr.write(
|
||||||
|
self.exception_detail(exception_type, exception_value, tb, request)
|
||||||
|
)
|
||||||
|
|
||||||
def check_error(self, data: dict, func: str = ""):
|
def check_error(self, data: dict, func: str = ""):
|
||||||
""""""
|
""""""
|
||||||
if data["status"] != "error":
|
if data["status"] != "error":
|
||||||
|
Loading…
Reference in New Issue
Block a user