Exceptions

Phenotastic defines a hierarchy of exceptions for error handling.

Exception Hierarchy

PhenotasticError (base)
├── PipelineError
├── ConfigurationError
├── InvalidImageError
└── InvalidMeshError

Base Exception

exception PhenotasticError[source]

Bases: Exception

Base exception for all Phenotastic errors.

Pipeline Exceptions

exception PipelineError[source]

Bases: PhenotasticError

Error during pipeline execution.

Raised when: - An unknown operation is requested - A pipeline step fails to execute - Pipeline context is in an invalid state

exception ConfigurationError[source]

Bases: PhenotasticError

Error in pipeline or operation configuration.

Raised when: - YAML configuration is invalid - Required parameters are missing - Parameter values are out of valid range

Data Validation Exceptions

exception InvalidImageError[source]

Bases: PhenotasticError

Error related to invalid image data.

Raised when: - Image has wrong dimensions - Image data type is incompatible - Image file cannot be read

exception InvalidMeshError[source]

Bases: PhenotasticError

Error related to invalid mesh data.

Raised when: - Mesh has no points or faces - Mesh is non-manifold when manifold is required - Mesh data is corrupted or inconsistent

Usage Example

from phenotastic import Pipeline, ConfigurationError

try:
    pipeline = Pipeline.from_yaml("config.yaml")
    result = pipeline.run(mesh)
except ConfigurationError as e:
    print(f"Invalid configuration: {e}")
except PipelineError as e:
    print(f"Pipeline failed: {e}")