(self, httpCode: int, reason: str, url: str, method: str, headers: dict, body: str, response, requestHeaders, requestBody)
| 9349 | return {'url': url, 'method': method, 'body': body, 'headers': headers} |
| 9350 | |
| 9351 | def handle_errors(self, httpCode: int, reason: str, url: str, method: str, headers: dict, body: str, response, requestHeaders, requestBody): |
| 9352 | if not response: |
| 9353 | return None # fallback to default error handler |
| 9354 | # |
| 9355 | # { |
| 9356 | # "ret_code": 10001, |
| 9357 | # "ret_msg": "ReadMapCB: expect {or n, but found \u0000, error " + |
| 9358 | # "found in #0 byte of ...||..., bigger context " + |
| 9359 | # "...||...", |
| 9360 | # "ext_code": '', |
| 9361 | # "ext_info": '', |
| 9362 | # "result": null, |
| 9363 | # "time_now": "1583934106.590436" |
| 9364 | # } |
| 9365 | # |
| 9366 | # { |
| 9367 | # "retCode":10001, |
| 9368 | # "retMsg":"symbol params err", |
| 9369 | # "result":{"symbol":"","bid":"","bidIv":"","bidSize":"","ask":"","askIv":"","askSize":"","lastPrice":"","openInterest":"","indexPrice":"","markPrice":"","markPriceIv":"","change24h":"","high24h":"","low24h":"","volume24h":"","turnover24h":"","totalVolume":"","totalTurnover":"","fundingRate":"","predictedFundingRate":"","nextFundingTime":"","countdownHour":"0","predictedDeliveryPrice":"","underlyingPrice":"","delta":"","gamma":"","vega":"","theta":""} |
| 9370 | # } |
| 9371 | # |
| 9372 | errorCode = self.safe_string_2(response, 'ret_code', 'retCode') |
| 9373 | if errorCode != '0': |
| 9374 | if errorCode == '30084': |
| 9375 | # not an error |
| 9376 | # https://github.com/ccxt/ccxt/issues/11268 |
| 9377 | # https://github.com/ccxt/ccxt/pull/11624 |
| 9378 | # POST https://api.bybit.com/v2/private/position/switch-isolated 200 OK |
| 9379 | # {"ret_code":30084,"ret_msg":"Isolated not modified","ext_code":"","ext_info":"","result":null,"time_now":"1642005219.937988","rate_limit_status":73,"rate_limit_reset_ms":1642005219894,"rate_limit":75} |
| 9380 | return None |
| 9381 | feedback = None |
| 9382 | if errorCode == '10005' and url.find('order') < 0: |
| 9383 | feedback = self.id + ' private api uses /user/v3/private/query-api to check if you have a unified account. The API key of user id must own one of permissions: "Account Transfer", "Subaccount Transfer", "Withdrawal" ' + body |
| 9384 | else: |
| 9385 | feedback = self.id + ' ' + body |
| 9386 | if body.find('Withdraw address chain or destination tag are not equal') > -1: |
| 9387 | feedback = feedback + '; You might also need to ensure the address is whitelisted' |
| 9388 | self.throw_broadly_matched_exception(self.exceptions['broad'], body, feedback) |
| 9389 | self.throw_exactly_matched_exception(self.exceptions['exact'], errorCode, feedback) |
| 9390 | raise ExchangeError(feedback) # unknown message |
| 9391 | return None |
nothing calls this directly
no test coverage detected