From 01b33c52786cf98e886a15d2315ec00ab142ff6a Mon Sep 17 00:00:00 2001 From: Maor Kleinberger Date: Mon, 21 Feb 2022 18:10:34 +0200 Subject: [PATCH] Fix exception semantics in _raise_for_status We want "The above exception was the direct cause of the following exception:" instead of "During handling of the above exception, another exception occurred:" Signed-off-by: Maor Kleinberger --- docker/api/client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/api/client.py b/docker/api/client.py index 2667922d9..7733d3343 100644 --- a/docker/api/client.py +++ b/docker/api/client.py @@ -267,7 +267,7 @@ def _raise_for_status(self, response): try: response.raise_for_status() except requests.exceptions.HTTPError as e: - raise create_api_error_from_http_exception(e) + raise create_api_error_from_http_exception(e) from e def _result(self, response, json=False, binary=False): assert not (json and binary)