summaryrefslogtreecommitdiff
path: root/searx/engines/elasticsearch.py
diff options
context:
space:
mode:
authorAlexandre Flament <alex@al-f.net>2020-12-03 10:31:44 +0100
committerGitHub <noreply@github.com>2020-12-03 10:31:44 +0100
commit89fbb85d454959be725cd4ca19c36c31d05d3289 (patch)
tree7ef098d4630c5416aad58f0d3ce5abb27390423f /searx/engines/elasticsearch.py
parent6b5a57882242f24f867b6aa14b79b514720c6d83 (diff)
parent64cccae99e625f3ebd879f94797decd0d824608d (diff)
Merge pull request #2332 from dalf/metrology-errors
[enh] record exception details per engine
Diffstat (limited to 'searx/engines/elasticsearch.py')
-rw-r--r--searx/engines/elasticsearch.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/searx/engines/elasticsearch.py b/searx/engines/elasticsearch.py
index 99e93d876..081736c1c 100644
--- a/searx/engines/elasticsearch.py
+++ b/searx/engines/elasticsearch.py
@@ -1,5 +1,6 @@
from json import loads, dumps
from requests.auth import HTTPBasicAuth
+from searx.exceptions import SearxEngineAPIException
base_url = 'http://localhost:9200'
@@ -107,7 +108,7 @@ def response(resp):
resp_json = loads(resp.text)
if 'error' in resp_json:
- raise Exception(resp_json['error'])
+ raise SearxEngineAPIException(resp_json['error'])
for result in resp_json['hits']['hits']:
r = {key: str(value) if not key.startswith('_') else value for key, value in result['_source'].items()}