Skip to content

Commit 5b2b9fd

Browse files
committed
error messages
1 parent 8d599f9 commit 5b2b9fd

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/textual/dom.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1492,7 +1492,7 @@ def query_one(
14921492
base_node._query_one_cache[cache_key] = node
14931493
return node
14941494

1495-
raise NoMatches(f"No nodes match {selector!r} on {self!r}")
1495+
raise NoMatches(f"No nodes match {selector!r} on {base_node!r}")
14961496

14971497
if TYPE_CHECKING:
14981498

@@ -1572,7 +1572,7 @@ def query_exactly_one(
15721572
base_node._query_one_cache[cache_key] = node
15731573
return node
15741574

1575-
raise NoMatches(f"No nodes match {selector!r} on {self!r}")
1575+
raise NoMatches(f"No nodes match {selector!r} on {base_node!r}")
15761576

15771577
if TYPE_CHECKING:
15781578

src/textual/getters.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,6 @@ def __get__(
181181
raise NoMatches(f"No child found with id={self.child_id!r}")
182182
if not isinstance(child, self.expect_type):
183183
raise WrongType(
184-
f"Child with id={id!r} is the wrong type; expected type {self.expect_type}, found {child}"
184+
f"Child with id={id!r} is the wrong type; expected type {self.expect_type.__name__!r}, found {child}"
185185
)
186186
return child

src/textual/widget.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,7 +1005,7 @@ def get_child_by_id(
10051005
return child
10061006
if not isinstance(child, expect_type):
10071007
raise WrongType(
1008-
f"Child with id={id!r} is the wrong type; expected type {expect_type}, found {child}"
1008+
f"Child with id={id!r} is the wrong type; expected type {expect_type.__name__!r}, found {child}"
10091009
)
10101010
return child
10111011

@@ -1041,7 +1041,7 @@ def get_widget_by_id(
10411041
widget = self.query_one(f"#{id}")
10421042
if expect_type is not None and not isinstance(widget, expect_type):
10431043
raise WrongType(
1044-
f"Descendant with id={id!r} is the wrong type; expected {expect_type}, found {widget}"
1044+
f"Descendant with id={id!r} is the wrong type; expected type {expect_type.__name__!r}, found {widget}"
10451045
)
10461046
return widget
10471047

0 commit comments

Comments
 (0)