summaryrefslogtreecommitdiff
path: root/searx/metrology/error_recorder.py
diff options
context:
space:
mode:
authorAlexandre Flament <alex@al-f.net>2020-12-11 14:52:18 +0100
committerGitHub <noreply@github.com>2020-12-11 14:52:18 +0100
commit9f8ebeca4481344ce7bd773a4f64360da01f0a77 (patch)
tree7834dc899b99db4ea3f9f81542e8e029bf5b7d04 /searx/metrology/error_recorder.py
parent033f39bff7b3365256491014140e35aa1e974d4e (diff)
parentd703119d3a313a406482b121ee94c6afee3bc307 (diff)
Merge pull request #2375 from dalf/raise_for_errors
[enh] add raise_for_httperror
Diffstat (limited to 'searx/metrology/error_recorder.py')
-rw-r--r--searx/metrology/error_recorder.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/searx/metrology/error_recorder.py b/searx/metrology/error_recorder.py
index 4b67235e1..fee1ef7d6 100644
--- a/searx/metrology/error_recorder.py
+++ b/searx/metrology/error_recorder.py
@@ -4,7 +4,8 @@ import logging
from json import JSONDecodeError
from urllib.parse import urlparse
from requests.exceptions import RequestException
-from searx.exceptions import SearxXPathSyntaxException, SearxEngineXPathException
+from searx.exceptions import (SearxXPathSyntaxException, SearxEngineXPathException, SearxEngineAPIException,
+ SearxEngineAccessDeniedException)
from searx import logger
@@ -100,6 +101,10 @@ def get_messages(exc, filename) -> typing.Tuple:
return (exc.xpath_str, exc.message)
if isinstance(exc, SearxEngineXPathException):
return (exc.xpath_str, exc.message)
+ if isinstance(exc, SearxEngineAPIException):
+ return (str(exc.args[0]), )
+ if isinstance(exc, SearxEngineAccessDeniedException):
+ return (exc.message, )
return ()