Skip to content

Commit 101bf68

Browse files
authored
Add error property to worker.py (#2865)
worker.error is described in the worker guide documentation but the property is not present in the code.
1 parent 9c4858a commit 101bf68

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/textual/worker.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,11 @@ def result(self) -> ResultType | None:
244244
"""The result of the worker, or `None` if there is no result."""
245245
return self._result
246246

247+
@property
248+
def error(self) -> BaseException | None:
249+
"""The exception raised by the worker, or `None` if there was no error."""
250+
return self._error
251+
247252
def update(
248253
self, completed_steps: int | None = None, total_steps: int | None = -1
249254
) -> None:

0 commit comments

Comments
 (0)