Skip to content

errors

This module contains various exceptions used by the project.

FailedToDeserialize

Bases: WomError, Generic[T]

Raised when a response from the WOM api fails to deserialize.

Parameters:

Name Type Description Default
method SerializerT[T]

The serializer method that was being called.

required
exc Exception

The exception that occurred.

required
Source code in wom/errors.py
class FailedToDeserialize(WomError, t.Generic[T]):
    """Raised when a response from the WOM api fails to deserialize.

    Args:
        method: The serializer method that was being called.
        exc: The exception that occurred.
    """

    def __init__(self, method: SerializerT[T], exc: Exception) -> None:
        super().__init__(f"Serializer call to `{method.__name__}` failed\n -> {exc}")

UnwrapError

Bases: WomError

Raised when calling unwrap() or unwrap_err() incorrectly.

Parameters:

Name Type Description Default
message str

The error message.

required
Source code in wom/errors.py
class UnwrapError(WomError):
    """Raised when calling [`unwrap()`][wom.Result.unwrap] or
    [`unwrap_err()`][wom.Result.unwrap_err] incorrectly.

    Args:
        message: The error message.
    """

    __slots__ = ()

    def __init__(self, message: str) -> None:
        super().__init__(f"Unwrap failed: {message}")

WomError

Bases: Exception

The base error all wom errors inherit from.

Source code in wom/errors.py
class WomError(Exception):
    """The base error all wom errors inherit from."""

    __slots__ = ()