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

Method handle_errors

python/ccxt/bullish.py:2904–2934  ·  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

2902 return self.token
2903
2904 def handle_errors(self, httpCode: int, reason: str, url: str, method: str, headers: dict, body: str, response, requestHeaders, requestBody):
2905 if response is None:
2906 return None # fallback to default error handler
2907 #
2908 # {
2909 # "type": "HttpInvalidParameterException",
2910 # "message": "HTTP_INVALID_PARAMETER: '100m' is not a valid time bucket"
2911 # }
2912 #
2913 # {
2914 # "message": "Order size outside valid range",
2915 # "raw": null,
2916 # "errorCode": 6023,
2917 # "errorCodeName": "ORDER_SIZE_OUTSIDE_VALID_RANGE"
2918 # }
2919 #
2920 code = self.safe_string(response, 'errorCode')
2921 type = self.safe_string(response, 'type')
2922 if (code is not None and code != '0' and code != '1001') or (type is not None and type == 'HttpInvalidParameterException'):
2923 message = ''
2924 errorCodeName = self.safe_string(response, 'errorCodeName')
2925 if errorCodeName is not None:
2926 message = errorCodeName
2927 else:
2928 message = type
2929 feedback = self.id + ' ' + body
2930 self.throw_exactly_matched_exception(self.exceptions['exact'], message, feedback)
2931 self.throw_broadly_matched_exception(self.exceptions['broad'], message, feedback)
2932 self.throw_exactly_matched_exception(self.exceptions['exact'], code, feedback)
2933 raise ExchangeError(feedback) # unknown message
2934 return None

Callers

nothing calls this directly

Calls 4

ExchangeErrorClass · 0.90
safe_stringMethod · 0.80

Tested by

no test coverage detected