Skip to content

Entity Id None Error

Module defining the EntityIdNotNoneNotAllowedError.

entity_id_none_error

Module defining the EntityIdNotNoneNotAllowedError.

EntityIdNoneError

Bases: NoneNotAllowedError

Raised when an entity ID is None but should not be.

Source code in src/forging_blocks/domain/errors/entity_id_none_error.py
class EntityIdNoneError(NoneNotAllowedError):
    """Raised when an entity ID is None but should not be."""

    def __init__(self, entity_class_name: str) -> None:
        message = ErrorMessage(f"Entity ID have to be defined for '{entity_class_name}'.")
        metadata = ErrorMetadata(
            context={
                "entity_class_name": entity_class_name,
            }
        )
        super().__init__(message=message, metadata=metadata)