Merge pull request #1591 from davep/compose-error-expand

Reraise compose TypeError from the error rather than None
This commit is contained in:
Will McGugan
2023-01-17 07:45:30 -08:00
committed by GitHub
3 changed files with 3 additions and 2 deletions

View File

@@ -28,6 +28,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- `COMPONENT_CLASSES` are now inherited from base classes https://github.com/Textualize/textual/issues/1399
- Watch methods may now take no parameters
- Added `compute` parameter to reactive
- A `TypeError` raised during `compose` now carries the full traceback.
### Fixed

View File

@@ -1569,7 +1569,7 @@ class App(Generic[ReturnType], DOMNode):
except TypeError as error:
raise TypeError(
f"{self!r} compose() returned an invalid response; {error}"
) from None
) from error
await self.mount_all(widgets)
def _on_idle(self) -> None:

View File

@@ -2395,7 +2395,7 @@ class Widget(DOMNode):
except TypeError as error:
raise TypeError(
f"{self!r} compose() returned an invalid response; {error}"
) from None
) from error
except Exception:
self.app.panic(Traceback())
else: