summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Czygan <martin.czygan@gmail.com>2021-03-16 21:08:37 +0100
committerMartin Czygan <martin.czygan@gmail.com>2021-03-16 21:08:37 +0100
commit95d8a16a8ecd728059652b4b42a29326d2da0def (patch)
tree7cd8875d7cd00e5e232666d2d9fe1fa32cb2b069
parent47b95829bd6be55312ed7f7e424adb2ec33164e8 (diff)
downloadfatcat-95d8a16a8ecd728059652b4b42a29326d2da0def.tar.gz
fatcat-95d8a16a8ecd728059652b4b42a29326d2da0def.zip
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
-rw-r--r--python/fatcat_web/search.py2
1 files changed, 1 insertions, 1 deletions
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