Source code for owtf.lib.exceptions

"""
owtf.lib.exceptions
~~~~~~~~~~~~~~~~~~~

Declares the framework exceptions and HTTP errors
"""
try:
    from http.client import responses
except ImportError:
    from httplib import responses

import tornado.web


[docs]class FrameworkException(Exception): def __init__(self, value): self.parameter = value def __repr__(self): return self.parameter
[docs]class APIError(tornado.web.HTTPError): """Equivalent to ``RequestHandler.HTTPError`` except for in name"""
[docs]def api_assert(condition, *args, **kwargs): """Assertion to fail with if not ``condition`` Asserts that ``condition`` is ``True``, else raises an ``APIError`` with the provided ``args`` and ``kwargs`` :type condition: bool """ if not condition: raise APIError(*args, **kwargs)
[docs]class FrameworkAbortException(FrameworkException): pass
[docs]class PluginAbortException(FrameworkException): pass
[docs]class UnreachableTargetException(FrameworkException): pass
[docs]class UnresolvableTargetException(FrameworkException): pass
[docs]class DBIntegrityException(FrameworkException): pass
[docs]class InvalidTargetReference(FrameworkException): pass
[docs]class InvalidSessionReference(FrameworkException): pass
[docs]class InvalidTransactionReference(FrameworkException): pass
[docs]class InvalidParameterType(FrameworkException): pass
[docs]class InvalidWorkerReference(FrameworkException): pass
[docs]class InvalidErrorReference(FrameworkException): pass
[docs]class InvalidWorkReference(FrameworkException): pass
[docs]class InvalidConfigurationReference(FrameworkException): pass
[docs]class InvalidUrlReference(FrameworkException): pass
[docs]class InvalidActionReference(FrameworkException): pass
[docs]class InvalidMessageReference(FrameworkException): pass
[docs]class InvalidMappingReference(FrameworkException): pass
[docs]class DatabaseNotRunningException(Exception): pass
[docs]class PluginException(Exception): pass
[docs]class PluginsDirectoryDoesNotExist(PluginException): """The specified plugin directory does not exist."""
[docs]class PluginsAlreadyLoaded(PluginException): """`load_plugins()` called twice."""