diff options
author | Bryan Newbold <bnewbold@archive.org> | 2020-05-21 17:07:06 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@archive.org> | 2020-05-21 17:07:06 -0700 |
commit | d12d03bd241d93ffc624747f9f60fdf7fbe18f14 (patch) | |
tree | 4fe1d04d9afc81ef38773046d5b7ad67ccccab99 /fatcat_scholar/search.py | |
parent | b6866c2c2bbcd5501e9d3fe073adfa65e5464aa0 (diff) | |
download | fatcat-scholar-d12d03bd241d93ffc624747f9f60fdf7fbe18f14.tar.gz fatcat-scholar-d12d03bd241d93ffc624747f9f60fdf7fbe18f14.zip |
UI mobile/tablet scaling; search error improvements
Diffstat (limited to 'fatcat_scholar/search.py')
-rw-r--r-- | fatcat_scholar/search.py | 5 |
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) |