MCPcopy Create free account
hub / github.com/ccxt/ccxt / handle_errors

Method handle_errors

python/ccxt/dydx.py:2337–2358  ·  view source on GitHub ↗
(self, httpCode: int, reason: str, url: str, method: str, headers: dict, body: str, response, requestHeaders, requestBody)

Source from the content-addressed store, hash-verified

2335 return {'url': url, 'method': method, 'body': body, 'headers': headers}
2336
2337 def handle_errors(self, httpCode: int, reason: str, url: str, method: str, headers: dict, body: str, response, requestHeaders, requestBody):
2338 if not response:
2339 return None # fallback to default error handler
2340 #
2341 # abci response
2342 # {"result": {"code": 0}}
2343 #
2344 # rest response
2345 # {"code": 123}
2346 #
2347 result = self.safe_dict(response, 'result')
2348 errorCode = self.safe_string(result, 'code')
2349 if not errorCode:
2350 errorCode = self.safe_string(response, 'code')
2351 if errorCode:
2352 errorCodeNum = self.parse_to_numeric(errorCode)
2353 if errorCodeNum > 0:
2354 feedback = self.id + ' ' + self.json(response)
2355 self.throw_exactly_matched_exception(self.exceptions['exact'], errorCode, feedback)
2356 self.throw_broadly_matched_exception(self.exceptions['broad'], body, feedback)
2357 raise ExchangeError(feedback)
2358 return None
2359
2360 def set_sandbox_mode(self, enable: bool):
2361 super(dydx, self).set_sandbox_mode(enable)

Callers

nothing calls this directly

Calls 7

ExchangeErrorClass · 0.90
safe_dictMethod · 0.80
safe_stringMethod · 0.80
parse_to_numericMethod · 0.80
jsonMethod · 0.45

Tested by

no test coverage detected