aboutsummaryrefslogtreecommitdiffstats
path: root/fatcat_scholar/search.py
diff options
context:
space:
mode:
Diffstat (limited to 'fatcat_scholar/search.py')
-rw-r--r--fatcat_scholar/search.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/fatcat_scholar/search.py b/fatcat_scholar/search.py
index f8dd7fb..080266a 100644
--- a/fatcat_scholar/search.py
+++ b/fatcat_scholar/search.py
@@ -162,7 +162,10 @@ def do_fulltext_search(query: FulltextQuery, deep_page_limit: int = 2000) -> Ful
except elasticsearch.exceptions.RequestError as e:
# this is a "user" error
print("elasticsearch 400: " + str(e.info), file=sys.stderr)
- raise ValueError(str(e.info))
+ if e.info.get('error', {}).get('root_cause', {}):
+ raise ValueError(str(e.info['error']['root_cause'][0].get('reason')))
+ else:
+ raise ValueError(str(e.info))
except elasticsearch.exceptions.TransportError as e:
# all other errors
print("elasticsearch non-200 status code: {}".format(e.info), file=sys.stderr)