Exceptions¶
Phenotastic defines a hierarchy of exceptions for error handling.
Exception Hierarchy¶
PhenotasticError (base)
├── PipelineError
├── ConfigurationError
├── InvalidImageError
└── InvalidMeshError
Base Exception¶
Pipeline Exceptions¶
- exception PipelineError[source]¶
Bases:
PhenotasticErrorError 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:
PhenotasticErrorError 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:
PhenotasticErrorError 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:
PhenotasticErrorError 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}")