diff options
author | Trygve Aaberge <trygveaa@gmail.com> | 2023-10-08 14:49:45 +0200 |
---|---|---|
committer | Trygve Aaberge <trygveaa@gmail.com> | 2024-02-18 11:32:54 +0100 |
commit | a4e25ab72710c95feef75651d3d4e5fe81fb249d (patch) | |
tree | 80f7c33e429d741a5c7f8e8d000728a18436ac73 /slack | |
parent | f5aae8a5a09c4c0c6ff456ced3edcc8731d264e4 (diff) | |
download | wee-slack-a4e25ab72710c95feef75651d3d4e5fe81fb249d.tar.gz |
Raise error if both error and response_code is missing
I experienced a KeyError on response_code and not sure when that could
happen, so log the output to check it if it happens again.
Diffstat (limited to 'slack')
-rw-r--r-- | slack/http.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/slack/http.py b/slack/http.py index 49b361e..85c9be3 100644 --- a/slack/http.py +++ b/slack/http.py @@ -94,6 +94,15 @@ async def http_request_url( if "error" in output: raise HttpError(url, options, None, None, output["error"]) + if "response_code" not in output: + raise HttpError( + url, + options, + None, + None, + f"Unexpectedly missing response_code, output: {output}", + ) + http_status = int(output["response_code"]) header_parts = output["headers"].split("\r\n\r\nHTTP/") return http_status, header_parts[-1], output["output"] |