Skip to content

Commit 42094c4

Browse files
committed
WIP
1 parent 8818432 commit 42094c4

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

tests/nexus/test_workflow_caller.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1087,7 +1087,13 @@ async def assert_handler_workflow_has_link_to_caller_workflow(
10871087

10881088
# Handler
10891089

1090-
ActionInSyncOp = Literal["raise_handler_error", "raise_operation_error"]
1090+
ActionInSyncOp = Literal[
1091+
"raise_handler_error", "raise_operation_error", "raise_custom_error"
1092+
]
1093+
1094+
1095+
class CustomError(Exception):
1096+
pass
10911097

10921098

10931099
@dataclass
@@ -1109,6 +1115,8 @@ async def op(self, ctx: StartOperationContext, input: ErrorTestInput) -> None:
11091115
raise nexusrpc.OperationError(
11101116
"test", state=nexusrpc.OperationErrorState.FAILED
11111117
)
1118+
elif input.action_in_sync_op == "raise_custom_error":
1119+
raise CustomError("test")
11121120
else:
11131121
raise NotImplementedError(
11141122
f"Unhandled action_in_sync_op: {input.action_in_sync_op}"
@@ -1144,7 +1152,8 @@ async def run(self, input: ErrorTestInput) -> list[str]:
11441152

11451153

11461154
@pytest.mark.parametrize(
1147-
"action_in_sync_op", ["raise_handler_error", "raise_operation_error"]
1155+
"action_in_sync_op",
1156+
["raise_handler_error", "raise_operation_error", "raise_custom_error"],
11481157
)
11491158
async def test_errors_raised_by_nexus_operation(
11501159
client: Client, action_in_sync_op: ActionInSyncOp
@@ -1166,10 +1175,16 @@ async def test_errors_raised_by_nexus_operation(
11661175
id=str(uuid.uuid4()),
11671176
task_queue=task_queue,
11681177
)
1178+
1179+
print(f"\n\n\n{action_in_sync_op}: \n", result, "\n\n\n")
1180+
11691181
if action_in_sync_op == "raise_handler_error":
11701182
assert result == ["NexusOperationError", "HandlerError"]
11711183
elif action_in_sync_op == "raise_operation_error":
11721184
assert result == ["NexusOperationError", "ApplicationError"]
1185+
elif action_in_sync_op == "raise_custom_error":
1186+
# assert result == ["NexusOperationError", "CustomError"]
1187+
pass
11731188
else:
11741189
raise NotImplementedError(
11751190
f"Unhandled action_in_sync_op: {action_in_sync_op}"

0 commit comments

Comments
 (0)