summaryrefslogtreecommitdiff
path: root/searx/search.py
diff options
context:
space:
mode:
authorAdam Tauber <asciimoo@gmail.com>2017-07-15 18:24:48 +0200
committerGitHub <noreply@github.com>2017-07-15 18:24:48 +0200
commitc30f73f8fda2b51cfd95967a29cc34a2036ffddd (patch)
tree26d830b0429d3ed19f75f9ae96aa437e02a69ec4 /searx/search.py
parent3bd5ce65950cb86ec678ff3d074635638d63fb5d (diff)
parentbdd9528c6b589a2f55dbde050583bebbba40d898 (diff)
Merge pull request #961 from kvch/user-visible-engine-errors
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))