Skip to content

TaskException

Represent a failed task.

Attributes:

Name Type Description
msg str

Stringified exception

exception_type str | None

The original exception's class name, e.g. "ValueError", if known. None for failures alchemical_queues itself raised without an underlying exception object (this shouldn't normally happen).

Source code in src/alchemical_queues/tasks/main.py
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
class TaskException:
    """Represent a failed task.

    Attributes:
        msg (str): Stringified exception
        exception_type (str | None): The original exception's class name, e.g.
            `"ValueError"`, if known. None for failures alchemical_queues itself
            raised without an underlying exception object (this shouldn't
            normally happen).
    """

    __slots__ = ["msg", "exception_type"]

    def __init__(self, msg: str, exception_type: Union[str, None] = None) -> None:
        self.msg: str = msg
        self.exception_type: Union[str, None] = exception_type

    def __repr__(self) -> str:
        label = self.exception_type or "TaskException"
        return f"<{label}: {self.msg}>"

    def __str__(self) -> str:
        return self.__repr__()