File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -54,9 +54,19 @@ async def __anext__(self) -> Any:
5454
5555 @property
5656 def result (self ) -> dict [str , Any ]:
57- """Final pipeline output dict. Raises if accessed before iteration completes."""
57+ """
58+ Final pipeline output dict, available only after a successful, complete run.
59+
60+ Raises a clear `RuntimeError` for each non-success state (not finished, cancelled, failed)
61+ so the caller does not need to inspect the underlying task to interpret the outcome.
62+ """
5863 if self ._task is None or not self ._task .done ():
59- raise RuntimeError ("Pipeline still running. Iterate this handle to completion first." )
64+ raise RuntimeError ("Pipeline has not finished; iterate the handle first." )
65+ if self ._task .cancelled ():
66+ raise RuntimeError ("Pipeline was cancelled; no result available." )
67+ exc = self ._task .exception ()
68+ if exc is not None :
69+ raise RuntimeError ("Pipeline failed; no result available." ) from exc
6070 return self ._task .result ()
6171
6272 async def aclose (self ) -> None :
You can’t perform that action at this time.
0 commit comments