diff options
Diffstat (limited to 'searx/exceptions.py')
-rw-r--r-- | searx/exceptions.py | 37 |
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) |