From 05e143429e892fb838bbff058391456ba3d0a19c Mon Sep 17 00:00:00 2001 From: Milas Bowman Date: Fri, 29 Jul 2022 11:08:00 -0400 Subject: [PATCH] api: preserve cause when re-raising error (#3023) Use `from e` to ensure that the error context is propagated correctly. Fixes #2702. Signed-off-by: Milas Bowman --- docker/errors.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/errors.py b/docker/errors.py index ba952562c..7725295f5 100644 --- a/docker/errors.py +++ b/docker/errors.py @@ -28,7 +28,7 @@ def create_api_error_from_http_exception(e): cls = ImageNotFound else: cls = NotFound - raise cls(e, response=response, explanation=explanation) + raise cls(e, response=response, explanation=explanation) from e class APIError(requests.exceptions.HTTPError, DockerException):