Skip to content

Exceptions

sereto.exceptions

SeretoCalledProcessError

Bases: SeretoException

Called process error.

Source code in sereto/exceptions.py
33
34
class SeretoCalledProcessError(SeretoException):
    """Called process error."""

SeretoEncryptionError

Bases: SeretoException

Encryption error.

Source code in sereto/exceptions.py
13
14
class SeretoEncryptionError(SeretoException):
    """Encryption error."""

SeretoException

Bases: Exception

There was an ambiguous exception.

Source code in sereto/exceptions.py
 9
10
class SeretoException(Exception):
    """There was an ambiguous exception."""

SeretoPathError

Bases: SeretoException

Path error.

Source code in sereto/exceptions.py
17
18
class SeretoPathError(SeretoException):
    """Path error."""

SeretoRuntimeError

Bases: SeretoException

Runtime error.

Source code in sereto/exceptions.py
21
22
class SeretoRuntimeError(SeretoException):
    """Runtime error."""

SeretoTypeError

Bases: SeretoException

Type error.

Source code in sereto/exceptions.py
25
26
class SeretoTypeError(SeretoException):
    """Type error."""

SeretoValueError

Bases: SeretoException, ValueError

Value error.

Source code in sereto/exceptions.py
29
30
class SeretoValueError(SeretoException, ValueError):
    """Value error."""

handle_exceptions(func)

Decorator for pretty printing SeReTo exceptions.

Source code in sereto/exceptions.py
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
def handle_exceptions[**P, R](func: Callable[P, R]) -> Callable[P, R]:
    """Decorator for pretty printing SeReTo exceptions."""

    @functools.wraps(func)
    def outer_function(*args: P.args, **kwargs: P.kwargs) -> R:
        try:
            return func(*args, **kwargs)
        except SystemExit:
            raise
        except KeyboardInterrupt:
            logger.warning("Operation interrupted by user")
            raise SystemExit(1) from None
        except (SeretoException, ValidationError) as e:
            logger.error(str(e))
            _log_debug_traceback(e)
            raise SystemExit(1) from None
        except Exception as e:
            logger.error("Unexpected error occurred: {}", type(e).__name__)
            _log_debug_traceback(e)
            raise SystemExit(1) from None

    return outer_function