Skip to content

Commit

Permalink
Add exception for calling an update method on a stub (#2095)
Browse files Browse the repository at this point in the history
Add exception for calling an update method on a stub
  • Loading branch information
Quinn-With-Two-Ns authored Jun 5, 2024
1 parent 1ad1c04 commit 1e79592
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,12 @@ public Object invoke(Object proxy, Method method, Object[] args) {
if (type == WorkflowMethodType.QUERY) {
throw new UnsupportedOperationException(
"Query is not supported from workflow to workflow. "
+ "Use activity that perform the query instead.");
+ "Use an activity that performs the query instead.");
}
if (type == WorkflowMethodType.UPDATE) {
throw new UnsupportedOperationException(
"Update is not supported from workflow to workflow. "
+ "Use an activity that performs the update instead.");
}
throw new IllegalArgumentException("unreachable");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,12 @@ public Object invoke(Object proxy, Method method, Object[] args) {
case SIGNAL:
stub.signal(methodMetadata.getName(), args);
break;
case UPDATE:
throw new UnsupportedOperationException(
"Cannot update a workflow with an external workflow stub "
+ "created through Workflow.newExternalWorkflowStub");
default:
throw new IllegalStateException("unreachale");
throw new IllegalStateException("unreachable");
}
return null;
}
Expand Down

0 comments on commit 1e79592

Please sign in to comment.