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

Method handle_errors

python/ccxt/async_support/krakenfutures.py:2947–2963  ·  view source on GitHub ↗
(self, code: int, reason: str, url: str, method: str, headers: dict, body: str, response, requestHeaders, requestBody)

Source from the content-addressed store, hash-verified

2945 }
2946
2947 def handle_errors(self, code: int, reason: str, url: str, method: str, headers: dict, body: str, response, requestHeaders, requestBody):
2948 if response is None:
2949 return None
2950 if code == 429:
2951 raise DDoSProtection(self.id + ' ' + body)
2952 errors = self.safe_value(response, 'errors')
2953 firstError = self.safe_value(errors, 0)
2954 firtErrorMessage = self.safe_string(firstError, 'message')
2955 message = self.safe_string(response, 'error', firtErrorMessage)
2956 if message is None:
2957 return None
2958 feedback = self.id + ' ' + body
2959 self.throw_exactly_matched_exception(self.exceptions['exact'], message, feedback)
2960 self.throw_broadly_matched_exception(self.exceptions['broad'], message, feedback)
2961 if code == 400:
2962 raise BadRequest(feedback)
2963 raise ExchangeError(feedback) # unknown message
2964
2965 def sign(self, path, api: Any = 'public', method='GET', params={}, headers: dict = None, body: Str = None):
2966 apiVersions = self.safe_value(self.options['versions'], api, {})

Callers

nothing calls this directly

Calls 7

DDoSProtectionClass · 0.90
BadRequestClass · 0.90
ExchangeErrorClass · 0.90
safe_valueMethod · 0.80
safe_stringMethod · 0.80

Tested by

no test coverage detected