From d12d03bd241d93ffc624747f9f60fdf7fbe18f14 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Thu, 21 May 2020 17:07:06 -0700 Subject: UI mobile/tablet scaling; search error improvements --- fatcat_scholar/search.py | 5 ++++- fatcat_scholar/templates/base.html | 18 ++++++++++++++++-- fatcat_scholar/templates/home.html | 2 +- fatcat_scholar/templates/search.html | 23 ++++++++++++++++++----- fatcat_scholar/web.py | 6 +++--- 5 files changed, 42 insertions(+), 12 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) diff --git a/fatcat_scholar/templates/base.html b/fatcat_scholar/templates/base.html index 78d4f29..9c7aba8 100644 --- a/fatcat_scholar/templates/base.html +++ b/fatcat_scholar/templates/base.html @@ -30,15 +30,29 @@ */