summaryrefslogtreecommitdiff
path: root/searx/exceptions.py
diff options
context:
space:
mode:
authorAlexandre Flament <alex@al-f.net>2020-11-26 15:12:11 +0100
committerAlexandre Flament <alex@al-f.net>2020-12-03 10:22:48 +0100
commit1d0c368746e0ae28ea042edaf4c75ee3a2b738c2 (patch)
tree8a277759920f97677510e0e72cc0f16d84817f11 /searx/exceptions.py
parent6b5a57882242f24f867b6aa14b79b514720c6d83 (diff)
downloadsearxng-1d0c368746e0ae28ea042edaf4c75ee3a2b738c2.tar.gz
searxng-1d0c368746e0ae28ea042edaf4c75ee3a2b738c2.zip
[enh] record details exception per engine
add an new API /stats/errors
Diffstat (limited to 'searx/exceptions.py')
-rw-r--r--searx/exceptions.py37
1 files changed, 37 insertions, 0 deletions
diff --git a/searx/exceptions.py b/searx/exceptions.py
index 2d1b1167e..82c1d76dc 100644
--- a/searx/exceptions.py
+++ b/searx/exceptions.py
@@ -34,8 +34,45 @@ class SearxParameterException(SearxException):
class SearxSettingsException(SearxException):
+ """Error while loading the settings"""
def __init__(self, message, filename):
super().__init__(message)
self.message = message
self.filename = filename
+
+
+class SearxEngineException(SearxException):
+ """Error inside an engine"""
+
+
+class SearxXPathSyntaxException(SearxEngineException):
+ """Syntax error in a XPATH"""
+
+ def __init__(self, xpath_spec, message):
+ super().__init__(str(xpath_spec) + " " + message)
+ self.message = message
+ # str(xpath_spec) to deal with str and XPath instance
+ self.xpath_str = str(xpath_spec)
+
+
+class SearxEngineResponseException(SearxEngineException):
+ """Impossible to parse the result of an engine"""
+
+
+class SearxEngineAPIException(SearxEngineResponseException):
+ """The website has returned an application error"""
+
+
+class SearxEngineCaptchaException(SearxEngineResponseException):
+ """The website has returned a CAPTCHA"""
+
+
+class SearxEngineXPathException(SearxEngineResponseException):
+ """Error while getting the result of an XPath expression"""
+
+ def __init__(self, xpath_spec, message):
+ super().__init__(str(xpath_spec) + " " + message)
+ self.message = message
+ # str(xpath_spec) to deal with str and XPath instance
+ self.xpath_str = str(xpath_spec)