Skip to content

Errors

Early return errors used for propagation.

EarlyOption

Bases: AnyError

The internal error raised by the early method.

Source code in src/wraps/early/errors.py
17
18
19
20
21
class EarlyOption(AnyError):
    """The internal error raised by the [`early`][wraps.option.OptionProtocol.early] method."""

    def __init__(self) -> None:
        super().__init__(EARLY_OPTION_WITHOUT_DECORATOR)

EarlyResult

Bases: AnyError, Generic[E]

The internal error raised by the early method.

Source code in src/wraps/early/errors.py
24
25
26
27
28
29
30
31
32
33
34
35
class EarlyResult(AnyError, Generic[E]):
    """The internal error raised by the [`early`][wraps.result.ResultProtocol.early] method."""

    def __init__(self, error: E) -> None:
        super().__init__(EARLY_RESULT_WITHOUT_DECORATOR)

        self._error = error

    @property
    def error(self) -> E:
        """The error to return early."""
        return self._error

error: E property

The error to return early.