mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
Ensure pretty traceback for error in Widget compose method (#1505)
* Ensure pretty traceback for error in Widget compose method * Fail fast and pretty tracebacks for Widget compose errors
This commit is contained in:
committed by
Rodrigo Girão Serrão
parent
1e8162e8d0
commit
c22cc30e71
@@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||
### Changed
|
||||
|
||||
- `MouseScrollUp` and `MouseScrollDown` now inherit from `MouseEvent` and have attached modifier keys. https://github.com/Textualize/textual/pull/1458
|
||||
- Fail-fast and print pretty tracebacks for Widget compose errors https://github.com/Textualize/textual/pull/1505
|
||||
|
||||
### Fixed
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@ from rich.measure import Measurement
|
||||
from rich.segment import Segment
|
||||
from rich.style import Style
|
||||
from rich.text import Text
|
||||
from rich.traceback import Traceback
|
||||
|
||||
from . import errors, events, messages
|
||||
from ._animator import DEFAULT_EASING, Animatable, BoundAnimator, EasingFunction
|
||||
@@ -2333,6 +2334,9 @@ class Widget(DOMNode):
|
||||
raise TypeError(
|
||||
f"{self!r} compose() returned an invalid response; {error}"
|
||||
) from None
|
||||
except Exception:
|
||||
self.app.panic(Traceback())
|
||||
else:
|
||||
await self.mount(*widgets)
|
||||
|
||||
def _on_mount(self, event: events.Mount) -> None:
|
||||
|
||||
Reference in New Issue
Block a user