diff --git a/unstructured/ingest/v2/pipeline/pipeline.py b/unstructured/ingest/v2/pipeline/pipeline.py index c45e1d2e8f..96e5a5ceb0 100644 --- a/unstructured/ingest/v2/pipeline/pipeline.py +++ b/unstructured/ingest/v2/pipeline/pipeline.py @@ -30,6 +30,10 @@ from unstructured.ingest.v2.processes.partitioner import PartitionerConfig +class PipelineError(Exception): + pass + + @dataclass class Pipeline: context: ProcessorConfig @@ -119,6 +123,8 @@ def run(self): finally: self.log_statuses() self.cleanup() + if self.context.status: + raise PipelineError("Pipeline did not run successfully") def clean_results(self, results: Optional[list[Union[Any, list[Any]]]]) -> Optional[list[Any]]: if not results: