Skip to content

Exceptions

cognite.pygen.exceptions

DataModelNotFound

Bases: PygenException

Raised when a data model(s) is not found.

Source code in cognite/pygen/exceptions.py
class DataModelNotFound(PygenException):
    """
    Raised when a data model(s) is not found.
    """

    def __init__(self, missing_ids: DataModelId | Sequence[DataModelId]):
        self.missing_ids = missing_ids

    def __str__(self) -> str:
        return f"Could not find data model(s) with id(s) {self.missing_ids}"

NameConflict

Bases: PygenException

Raised when a name conflict is detected.

Source code in cognite/pygen/exceptions.py
class NameConflict(PygenException):
    """
    Raised when a name conflict is detected.
    """

    def __init__(self, conflicting_names: list[tuple[str, list[dm.VersionedDataModelingId]]], class_name: str) -> None:
        self.conflicting_names = conflicting_names
        self.class_name = class_name

    def __str__(self) -> str:
        return (
            f"Name conflict detected in {self.class_name}. The following names are used by multiple views/data models: "
            f"{self.conflicting_names}"
        )

PygenException

Bases: Exception

Base class for all exceptions raised by pygen.

Source code in cognite/pygen/exceptions.py
class PygenException(Exception):
    """
    Base class for all exceptions raised by pygen.
    """

    pass