summaryrefslogtreecommitdiff
path: root/searx/search.py
diff options
context:
space:
mode:
authorNoémi Ványi <sitbackandwait@gmail.com>2017-07-09 22:09:46 +0200
committerNoémi Ványi <sitbackandwait@gmail.com>2017-07-12 16:29:11 +0200
commit243d3e4298c93014f37ca6f1f957a60cb09f4ae1 (patch)
tree568d15c055c1841dd5bdb37b5be2a81c25d2efd0 /searx/search.py
parent3bd5ce65950cb86ec678ff3d074635638d63fb5d (diff)
downloadsearxng-243d3e4298c93014f37ca6f1f957a60cb09f4ae1.tar.gz
searxng-243d3e4298c93014f37ca6f1f957a60cb09f4ae1.zip
show engine errors in infobox && add new error alert
Diffstat (limited to 'searx/search.py')
-rw-r--r--searx/search.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/searx/search.py b/searx/search.py
index 790e7d071..3ea349ade 100644
--- a/searx/search.py
+++ b/searx/search.py
@@ -20,6 +20,7 @@ import sys
import threading
from time import time
from uuid import uuid4
+from flask_babel import gettext
import requests.exceptions
import searx.poolrequests as requests_lib
from searx.engines import (
@@ -133,18 +134,21 @@ def search_one_request_safe(engine_name, query, request_params, result_container
requests_exception = False
if (issubclass(e.__class__, requests.exceptions.Timeout)):
+ result_container.add_unresponsive_engine((engine_name, gettext('timeout')))
# requests timeout (connect or read)
logger.error("engine {0} : HTTP requests timeout"
"(search duration : {1} s, timeout: {2} s) : {3}"
.format(engine_name, search_duration, timeout_limit, e.__class__.__name__))
requests_exception = True
elif (issubclass(e.__class__, requests.exceptions.RequestException)):
+ result_container.add_unresponsive_engine((engine_name, gettext('request exception')))
# other requests exception
logger.exception("engine {0} : requests exception"
"(search duration : {1} s, timeout: {2} s) : {3}"
.format(engine_name, search_duration, timeout_limit, e))
requests_exception = True
else:
+ result_container.add_unresponsive_engine((engine_name, gettext('unexpected crash')))
# others errors
logger.exception('engine {0} : exception : {1}'.format(engine_name, e))