Skip to content

Commit bc0e8a2

Browse files
committed
Fix generator method name
1 parent a0f366b commit bc0e8a2

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

scripts/gen_visitors.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,10 +198,12 @@ async def visit(
198198
self, f: Callable[[Payload], Awaitable[Payload]], root: Any
199199
) -> None:
200200
\"\"\"Visits the given root message with the given function.\"\"\"
201-
method_name = "visit_" + root.DESCRIPTOR.full_name.replace(".", "_")
201+
method_name = "_visit_" + root.DESCRIPTOR.full_name.replace(".", "_")
202202
method = getattr(self, method_name, None)
203203
if method is not None:
204204
await method(f, root)
205+
else:
206+
raise ValueError(f"Unknown root message type: {root.DESCRIPTOR.full_name}")
205207
206208
"""
207209

temporalio/bridge/_visitor.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,12 @@ async def visit(
1717
self, f: Callable[[Payload], Awaitable[Payload]], root: Any
1818
) -> None:
1919
"""Visits the given root message with the given function."""
20-
method_name = "visit_" + root.DESCRIPTOR.full_name.replace(".", "_")
20+
method_name = "_visit_" + root.DESCRIPTOR.full_name.replace(".", "_")
2121
method = getattr(self, method_name, None)
2222
if method is not None:
2323
await method(f, root)
24+
else:
25+
raise ValueError(f"Unknown root message type: {root.DESCRIPTOR.full_name}")
2426

2527
async def _visit_temporal_api_common_v1_Payload(self, f, o):
2628
o.CopyFrom(await f(o))

0 commit comments

Comments
 (0)