Skip to content

PyventusException class

Bases: Exception

A custom exception class for the Pyventus package.

Notes:

  • This class provides a robust mechanism for handling and identifying potential exceptions within the Pyventus package.

  • This class inherits from the base Exception class in Python, allowing it to be raised as needed.

Source code in pyventus/core/exceptions/pyventus_exception.py
class PyventusException(Exception):
    """
    A custom exception class for the Pyventus package.

    **Notes:**

    -   This class provides a robust mechanism for handling and identifying potential
        exceptions within the Pyventus package.

    -   This class inherits from the base `Exception` class in Python, allowing it to be
        raised as needed.
    """

    def __init__(self, errors: str | list[str] | None = None):
        """
        Initialize an instance of `PyventusException`.

        :param errors: The error messages associated with the exception. Defaults to `None`.
        """
        self.errors: str | list[str] = errors if errors else self.__class__.__name__
        super().__init__(errors)

Attributes

errors instance-attribute

errors: str | list[str] = errors if errors else __name__

Functions

__init__

__init__(errors: str | list[str] | None = None)

Initialize an instance of PyventusException.

PARAMETER DESCRIPTION
errors

The error messages associated with the exception. Defaults to None.

TYPE: str | list[str] | None DEFAULT: None

Source code in pyventus/core/exceptions/pyventus_exception.py
def __init__(self, errors: str | list[str] | None = None):
    """
    Initialize an instance of `PyventusException`.

    :param errors: The error messages associated with the exception. Defaults to `None`.
    """
    self.errors: str | list[str] = errors if errors else self.__class__.__name__
    super().__init__(errors)