Source code for resilient_exporters.exceptions
__all__ = ["ResilientExporterException", "MissingModuleError", \
"MissingConfigError", "InvalidConfigError", "ExportError", \
"ConnectionError", "DataTypeError", "TimeoutError"]
[docs]class ResilientExporterException(Exception):
"""Something wrong occured when using exporters."""
def __init__(self, exporter=None, *args, **kwargs):
if exporter:
self.type = type(exporter).__name__
self.name = exporter.name
self.content = f"Exception raised in {self.name} of type {self.type}"
super(ResilientExporterError, self).__init__(self.content)
else:
super(ResilientExporterError, self).__init__(*args, **kwargs)
[docs]class MissingModuleError(ResilientExporterException, ModuleNotFoundError):
"""Module not found. Can be installed doing resilient-exporters[...]"""
[docs]class MissingConfigError(ResilientExporterException):
"""A piece of configuration is missing"""
[docs]class InvalidConfigError(ResilientExporterException):
"""A piece of configuration is wrong"""
[docs]class ExportError(ResilientExporterException):
"""An export job failed"""
[docs]class ConnectionError(ExportError):
"""Could not connect to target"""
[docs]class DataTypeError(ExportError, TypeError):
"""Provided is of the wrong type"""
[docs]class TimeoutError(ExportError):
"""An export attempt has timed out"""