summaryrefslogtreecommitdiffstats
path: root/fatcat_scholar/web.py
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@archive.org>2020-05-21 17:07:06 -0700
committerBryan Newbold <bnewbold@archive.org>2020-05-21 17:07:06 -0700
commitd12d03bd241d93ffc624747f9f60fdf7fbe18f14 (patch)
tree4fe1d04d9afc81ef38773046d5b7ad67ccccab99 /fatcat_scholar/web.py
parentb6866c2c2bbcd5501e9d3fe073adfa65e5464aa0 (diff)
downloadfatcat-scholar-d12d03bd241d93ffc624747f9f60fdf7fbe18f14.tar.gz
fatcat-scholar-d12d03bd241d93ffc624747f9f60fdf7fbe18f14.zip
UI mobile/tablet scaling; search error improvements
Diffstat (limited to 'fatcat_scholar/web.py')
-rw-r--r--fatcat_scholar/web.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/fatcat_scholar/web.py b/fatcat_scholar/web.py
index 06d6a02..e2fde9b 100644
--- a/fatcat_scholar/web.py
+++ b/fatcat_scholar/web.py
@@ -132,16 +132,16 @@ async def web_search(request: Request, query: FulltextQuery = Depends(FulltextQu
if content.mimetype == "application/json":
return await search(query)
hits : Optional[FulltextHits] = None
- search_error: Optional[str] = None
+ search_error: Optional[dict] = None
status_code: int = 200
if query.q is not None:
try:
hits = do_fulltext_search(query)
except ValueError as e:
- search_error = str(e)
+ search_error = dict(type="query", message=str(e))
status_code = 400
except IOError as e:
- search_error = str(e)
+ search_error = dict(type="backend", message=str(e))
status_code = 500
return i18n_templates[lang.code].TemplateResponse(
"search.html",