🟢 attrs

examples/attrs_exception.py

from attrs import define

from documented import DocumentedError


@define
class DeathStarHasExploded(DocumentedError):
    """
    This Death Star has exploded.

    You will have to build a new one, {self.user}
    """

    user: str


raise DeathStarHasExploded(user='Darth')

python

Traceback (most recent call last):
  File "📂/attrs_exception.py", line 17, in <module>
    raise DeathStarHasExploded(user='Darth')
DeathStarHasExploded: This Death Star has exploded.

You will have to build a new one, Darth