From 4244d68bb38410c417a1cfbe6a5c3c05b4a92f95 Mon Sep 17 00:00:00 2001 From: Carl Csaposs Date: Wed, 3 Apr 2024 11:41:20 +0200 Subject: [PATCH] Check for RequestException --- lib/charms/opensearch/v0/opensearch_distro.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/charms/opensearch/v0/opensearch_distro.py b/lib/charms/opensearch/v0/opensearch_distro.py index a5925636b7..e068dbf50e 100644 --- a/lib/charms/opensearch/v0/opensearch_distro.py +++ b/lib/charms/opensearch/v0/opensearch_distro.py @@ -262,7 +262,7 @@ def call(url: str) -> requests.Response: if resp_status_code: return resp.status_code except (requests.RequestException, urllib3.exceptions.HTTPError) as e: - if not isinstance(e, requests.HTTPError): + if not isinstance(e, requests.RequestException) or e.response is None: raise OpenSearchHttpError(response_text=str(e)) if resp_status_code: