From 95d8a16a8ecd728059652b4b42a29326d2da0def Mon Sep 17 00:00:00 2001 From: Martin Czygan Date: Tue, 16 Mar 2021 21:08:37 +0100 Subject: search: exception info is optional docs ("where available") and example: * https://elasticsearch-py.readthedocs.io/en/v7.11.0/exceptions.html#elasticsearch.TransportError * https://github.com/elastic/elasticsearch-py/blob/4441da0cbc4ecd02c81b93830b1318647b4018f9/elasticsearch/exceptions.py#L85 sentry-id: 79943 --- python/fatcat_web/search.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/fatcat_web/search.py b/python/fatcat_web/search.py index 6a419fa8..d7547cc8 100644 --- a/python/fatcat_web/search.py +++ b/python/fatcat_web/search.py @@ -130,7 +130,7 @@ def wrap_es_execution(search: Search) -> Any: # all other errors print("elasticsearch non-200 status code: {}".format(e.info), file=sys.stderr) description = None - if e.info.get("error", {}).get("root_cause", {}): + if e.info and e.info.get("error", {}).get("root_cause", {}): description = str(e.info["error"]["root_cause"][0].get("reason")) raise FatcatSearchError(e.status_code, str(e.error), description) return resp -- cgit v1.2.3