@@ -1087,7 +1087,13 @@ async def assert_handler_workflow_has_link_to_caller_workflow(
1087
1087
1088
1088
# Handler
1089
1089
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
1091
1097
1092
1098
1093
1099
@dataclass
@@ -1109,6 +1115,8 @@ async def op(self, ctx: StartOperationContext, input: ErrorTestInput) -> None:
1109
1115
raise nexusrpc .OperationError (
1110
1116
"test" , state = nexusrpc .OperationErrorState .FAILED
1111
1117
)
1118
+ elif input .action_in_sync_op == "raise_custom_error" :
1119
+ raise CustomError ("test" )
1112
1120
else :
1113
1121
raise NotImplementedError (
1114
1122
f"Unhandled action_in_sync_op: { input .action_in_sync_op } "
@@ -1144,7 +1152,8 @@ async def run(self, input: ErrorTestInput) -> list[str]:
1144
1152
1145
1153
1146
1154
@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" ],
1148
1157
)
1149
1158
async def test_errors_raised_by_nexus_operation (
1150
1159
client : Client , action_in_sync_op : ActionInSyncOp
@@ -1166,10 +1175,16 @@ async def test_errors_raised_by_nexus_operation(
1166
1175
id = str (uuid .uuid4 ()),
1167
1176
task_queue = task_queue ,
1168
1177
)
1178
+
1179
+ print (f"\n \n \n { action_in_sync_op } : \n " , result , "\n \n \n " )
1180
+
1169
1181
if action_in_sync_op == "raise_handler_error" :
1170
1182
assert result == ["NexusOperationError" , "HandlerError" ]
1171
1183
elif action_in_sync_op == "raise_operation_error" :
1172
1184
assert result == ["NexusOperationError" , "ApplicationError" ]
1185
+ elif action_in_sync_op == "raise_custom_error" :
1186
+ # assert result == ["NexusOperationError", "CustomError"]
1187
+ pass
1173
1188
else :
1174
1189
raise NotImplementedError (
1175
1190
f"Unhandled action_in_sync_op: { action_in_sync_op } "
0 commit comments