diff options
author | Trygve Aaberge <trygveaa@gmail.com> | 2023-01-28 19:29:00 +0100 |
---|---|---|
committer | Trygve Aaberge <trygveaa@gmail.com> | 2024-02-18 11:32:53 +0100 |
commit | 66e54b06896a9de7b35d1700ad34b25778780408 (patch) | |
tree | d8fa5d1de6b2d2fda57262b3f92b5eb47fcef1fd /slack | |
parent | 9b726746265f1d0a57e1b211934aa07a9cfdc712 (diff) | |
download | wee-slack-66e54b06896a9de7b35d1700ad34b25778780408.tar.gz |
Include options in HttpError
Diffstat (limited to 'slack')
-rw-r--r-- | slack/error.py | 12 | ||||
-rw-r--r-- | slack/http.py | 4 |
2 files changed, 12 insertions, 4 deletions
diff --git a/slack/error.py b/slack/error.py index 8a8c1b9..17427f7 100644 --- a/slack/error.py +++ b/slack/error.py @@ -1,6 +1,6 @@ from __future__ import annotations -from typing import TYPE_CHECKING, Mapping, Union +from typing import TYPE_CHECKING, Dict, Mapping, Union if TYPE_CHECKING: from slack_api.slack_error import SlackErrorResponse @@ -9,9 +9,17 @@ if TYPE_CHECKING: class HttpError(Exception): - def __init__(self, url: str, return_code: int, http_status_code: int, error: str): + def __init__( + self, + url: str, + options: Dict[str, str], + return_code: int, + http_status_code: int, + error: str, + ): super().__init__() self.url = url + self.options = options self.return_code = return_code self.http_status_code = http_status_code self.error = error diff --git a/slack/http.py b/slack/http.py index 820abb8..b899690 100644 --- a/slack/http.py +++ b/slack/http.py @@ -74,7 +74,7 @@ async def http_request( ) await sleep(1000) return await http_request(url, options, timeout, max_retries - 1) - raise HttpError(url, return_code, 0, err) + raise HttpError(url, options, return_code, 0, err) parts = out.split("\r\n\r\nHTTP/") last_header_part, body = parts[-1].split("\r\n\r\n", 1) @@ -94,6 +94,6 @@ async def http_request( return await http_request(url, options, timeout) if http_status >= 400: - raise HttpError(url, return_code, http_status, body) + raise HttpError(url, options, return_code, http_status, body) return body |