aboutsummaryrefslogtreecommitdiff
path: root/gn3/api
diff options
context:
space:
mode:
authorJohn Nduli2024-07-04 19:24:06 +0300
committerBonfaceKilz2024-07-05 14:37:10 +0300
commitd7869a1f0ed7915e0dd11bb51c49959d0b973315 (patch)
treecdf39f613bb5bb54e9769029f8b9e9edf9ba6458 /gn3/api
parent52cd294c2f1d06dddbd6ff613b11f8bc43066038 (diff)
downloadgenenetwork3-d7869a1f0ed7915e0dd11bb51c49959d0b973315.tar.gz
fix: return query error message from xapian
Diffstat (limited to 'gn3/api')
-rw-r--r--gn3/api/search.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/gn3/api/search.py b/gn3/api/search.py
index 588e11d..7242ac1 100644
--- a/gn3/api/search.py
+++ b/gn3/api/search.py
@@ -268,8 +268,10 @@ def search_results():
maximum_results_per_page = 50000
if results_per_page > maximum_results_per_page:
abort(400, description="Requested too many search results")
-
- query = parse_query(Path(current_app.config["DATA_DIR"]) / "synteny", querystring)
+ try:
+ query = parse_query(Path(current_app.config["DATA_DIR"]) / "synteny", querystring)
+ except xapian.QueryParserError as err:
+ return jsonify({"error_type": str(err.get_type()), "error": err.get_msg()}), 400
traits = []
# pylint: disable=invalid-name
with xapian_database(current_app.config["XAPIAN_DB_PATH"]) as db: