Skip to content

Interrupt

Interruption exceptions.

Interrupt

Bases: Exception

Custom exception class for interruptions.

Source code in src/asimpy/interrupt.py
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
class Interrupt(Exception):
    """Custom exception class for interruptions."""

    def __init__(self, cause: Any):
        """
        Construct a new interruption exception.

        Args:
            cause: reason for interruption.
        """
        super().__init__()
        self.cause = cause

    def __str__(self) -> str:
        """
        Format interruption as printable string.

        Returns: string representation of interruption and cause.
        """
        return f"Interrupt({self.cause})"

__init__(cause)

Construct a new interruption exception.

Parameters:

Name Type Description Default
cause Any

reason for interruption.

required
Source code in src/asimpy/interrupt.py
 9
10
11
12
13
14
15
16
17
def __init__(self, cause: Any):
    """
    Construct a new interruption exception.

    Args:
        cause: reason for interruption.
    """
    super().__init__()
    self.cause = cause

__str__()

Format interruption as printable string.

Returns: string representation of interruption and cause.

Source code in src/asimpy/interrupt.py
19
20
21
22
23
24
25
def __str__(self) -> str:
    """
    Format interruption as printable string.

    Returns: string representation of interruption and cause.
    """
    return f"Interrupt({self.cause})"