Skip to content

Commit 1e79592

Browse files
Add exception for calling an update method on a stub (#2095)
Add exception for calling an update method on a stub
1 parent 1ad1c04 commit 1e79592

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

temporal-sdk/src/main/java/io/temporal/internal/sync/ChildWorkflowInvocationHandler.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,12 @@ public Object invoke(Object proxy, Method method, Object[] args) {
9090
if (type == WorkflowMethodType.QUERY) {
9191
throw new UnsupportedOperationException(
9292
"Query is not supported from workflow to workflow. "
93-
+ "Use activity that perform the query instead.");
93+
+ "Use an activity that performs the query instead.");
94+
}
95+
if (type == WorkflowMethodType.UPDATE) {
96+
throw new UnsupportedOperationException(
97+
"Update is not supported from workflow to workflow. "
98+
+ "Use an activity that performs the update instead.");
9499
}
95100
throw new IllegalArgumentException("unreachable");
96101
}

temporal-sdk/src/main/java/io/temporal/internal/sync/ExternalWorkflowInvocationHandler.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,12 @@ public Object invoke(Object proxy, Method method, Object[] args) {
6464
case SIGNAL:
6565
stub.signal(methodMetadata.getName(), args);
6666
break;
67+
case UPDATE:
68+
throw new UnsupportedOperationException(
69+
"Cannot update a workflow with an external workflow stub "
70+
+ "created through Workflow.newExternalWorkflowStub");
6771
default:
68-
throw new IllegalStateException("unreachale");
72+
throw new IllegalStateException("unreachable");
6973
}
7074
return null;
7175
}

0 commit comments

Comments
 (0)