Skip to content

chatomon.errors

Exceptions raised by chatomon.

This module imports nothing from chatomon, so every other module can use it.

Classes:

Name Description
ChatomonError

Base class of every exception raised by chatomon.

ChatomonConfigError

An atom, orbital or connector is configured incorrectly.

MissingExtraError

An optional dependency needed by a chatomon module is not installed.

MissingAnnotationsError

An orbital reads annotations that no earlier orbital produced in this turn.

ChatomonError

Bases: Exception

Base class of every exception raised by chatomon.

ChatomonConfigError

Bases: ChatomonError, ValueError

An atom, orbital or connector is configured incorrectly.

The message always says what to change.

MissingExtraError

MissingExtraError(extra: str, package: str)

Bases: ChatomonError, ImportError

An optional dependency needed by a chatomon module is not installed.

Parameters:

Name Type Description Default
extra str

Name of the chatomon extra that provides the dependency.

required
package str

Name of the missing distribution.

required
Source code in src/chatomon/errors.py
37
38
39
40
41
42
def __init__(self, extra: str, package: str) -> None:
    self.extra = extra
    self.package = package
    super().__init__(
        f"{package!r} is not installed. Install it with: pip install 'chatomon[{extra}]'"
    )

MissingAnnotationsError

MissingAnnotationsError(
    orbital: str, missing: Sequence[str]
)

Bases: ChatomonError

An orbital reads annotations that no earlier orbital produced in this turn.

It is raised by the engine inside the orbital's execution, so the orbital's on_error policy applies.

Parameters:

Name Type Description Default
orbital str

Name of the orbital that needed the annotations.

required
missing Sequence[str]

Names of the orbitals whose annotations are missing.

required
Source code in src/chatomon/errors.py
56
57
58
59
60
def __init__(self, orbital: str, missing: Sequence[str]) -> None:
    self.orbital = orbital
    self.missing = tuple(missing)
    names = ", ".join(repr(name) for name in self.missing)
    super().__init__(f"orbital {orbital!r} reads annotations that are missing: {names}")