From d14248b7f1fea2053ea0b13d259256479e463f18 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Mon, 7 Dec 2020 18:42:30 -0800 Subject: work around mypy complaint about exception union type --- fatcat_scholar/search.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fatcat_scholar/search.py b/fatcat_scholar/search.py index 5a4d47f..b57a16d 100644 --- a/fatcat_scholar/search.py +++ b/fatcat_scholar/search.py @@ -314,8 +314,9 @@ def do_fulltext_search( query_start = datetime.datetime.now() try: resp = search.execute() - except elasticsearch.exceptions.RequestError as e: + except elasticsearch.exceptions.RequestError as e_raw: # this is a "user" error + e: Any = e_raw logging.warn("elasticsearch 400: " + str(e.info)) if e.info.get("error", {}).get("root_cause", {}): raise ValueError(str(e.info["error"]["root_cause"][0].get("reason"))) from e -- cgit v1.2.3