Skip to content

Commit 2a44ad6

Browse files
Merge pull request #297 from adamtheturtle/line-no-valueerror
Add line number to text child value error
2 parents 804bf17 + 512f9f9 commit 2a44ad6

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/sphinx_notion/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,8 @@ def _process_rich_text_node(child: nodes.Node) -> Text:
213213
are handled by registered functions.
214214
"""
215215
unsupported_child_type_msg = (
216-
f"Unsupported child type: {type(child).__name__}."
216+
f"Unsupported node type within text: {type(child).__name__} on line "
217+
f"{child.parent.line} in {child.parent.source}."
217218
)
218219
# We use ``TRY004`` here because we want to raise a
219220
# ``ValueError`` if the child type is unsupported, not a

tests/test_integration.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2771,7 +2771,10 @@ def footnote_role(
27712771
27722772
app.add_role('footnote', footnote_role)
27732773
"""
2774-
expected_message = r"^Unsupported child type: footnote_reference\.$"
2774+
expected_message = (
2775+
r"^Unsupported node type within text: footnote_reference on line 1 in "
2776+
rf"{re.escape(pattern=str(object=tmp_path / 'src' / 'index.rst'))}\.$"
2777+
)
27752778
with pytest.raises(expected_exception=ValueError, match=expected_message):
27762779
_assert_rst_converts_to_notion_objects(
27772780
rst_content=rst_content,

0 commit comments

Comments
 (0)