From 3928b37e1cc8b1d35c6791be10ecd69505cfb2c1 Mon Sep 17 00:00:00 2001 From: Bouwe Andela Date: Mon, 28 Nov 2022 18:43:43 +0100 Subject: [PATCH 1/2] Gracefully handle more errors --- esmvalcore/esgf/_search.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/esmvalcore/esgf/_search.py b/esmvalcore/esgf/_search.py index 4f97b527f7..bcd9e1dc96 100644 --- a/esmvalcore/esgf/_search.py +++ b/esmvalcore/esgf/_search.py @@ -110,7 +110,11 @@ def _search_index_nodes(facets): ) FIRST_ONLINE_INDEX_NODE = url return results - except requests.exceptions.Timeout as error: + except ( + requests.exceptions.ConnectionError, + requests.exceptions.HTTPError, + requests.exceptions.Timeout, + ) as error: errors.append(error) raise FileNotFoundError("Failed to search ESGF, unable to connect:\n" + From eb4322a7db7d95c87a04e20849e75b5e1beea37c Mon Sep 17 00:00:00 2001 From: Bouwe Andela Date: Mon, 28 Nov 2022 18:48:26 +0100 Subject: [PATCH 2/2] Add debug log message --- esmvalcore/esgf/_search.py | 1 + 1 file changed, 1 insertion(+) diff --git a/esmvalcore/esgf/_search.py b/esmvalcore/esgf/_search.py index bcd9e1dc96..7807e25eaa 100644 --- a/esmvalcore/esgf/_search.py +++ b/esmvalcore/esgf/_search.py @@ -115,6 +115,7 @@ def _search_index_nodes(facets): requests.exceptions.HTTPError, requests.exceptions.Timeout, ) as error: + logger.debug("Unable to connect to %s due to %s", url, error) errors.append(error) raise FileNotFoundError("Failed to search ESGF, unable to connect:\n" +