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

Method handle_errors

python/ccxt/latoken.py:1749–1769  ·  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

1747 return {'url': url, 'method': method, 'body': body, 'headers': headers}
1748
1749 def handle_errors(self, code: int, reason: str, url: str, method: str, headers: dict, body: str, response, requestHeaders, requestBody):
1750 if not response:
1751 return None
1752 #
1753 # {"result":false,"message":"invalid API key, signature or digest","error":"BAD_REQUEST","status":"FAILURE"}
1754 # {"result":false,"message":"request expired or bad <timeAlive>/<timestamp> format","error":"BAD_REQUEST","status":"FAILURE"}
1755 # {"message":"Internal Server Error","error":"INTERNAL_ERROR","status":"FAILURE"}
1756 # {"result":false,"message":"Internal error","error":"For input string: \"NaN\"","status":"FAILURE"}
1757 #
1758 message = self.safe_string(response, 'message')
1759 feedback = self.id + ' ' + body
1760 if message is not None:
1761 self.throw_exactly_matched_exception(self.exceptions['exact'], message, feedback)
1762 self.throw_broadly_matched_exception(self.exceptions['broad'], message, feedback)
1763 error = self.safe_value(response, 'error')
1764 errorMessage = self.safe_string(error, 'message')
1765 if (error is not None) or (errorMessage is not None):
1766 self.throw_exactly_matched_exception(self.exceptions['exact'], error, feedback)
1767 self.throw_broadly_matched_exception(self.exceptions['broad'], body, feedback)
1768 raise ExchangeError(feedback) # unknown message
1769 return None

Callers

nothing calls this directly

Calls 5

ExchangeErrorClass · 0.90
safe_stringMethod · 0.80
safe_valueMethod · 0.80

Tested by

no test coverage detected