Skip to content

Commit d3a8515

Browse files
authored
handle grpc status error for async signal workflow API (#701)
1 parent c6f41d7 commit d3a8515

File tree

1 file changed

+19
-15
lines changed

1 file changed

+19
-15
lines changed

src/main/java/com/uber/cadence/internal/compatibility/Thrift2ProtoAdapter.java

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -843,21 +843,25 @@ public void RequestCancelWorkflowExecution(
843843
public void SignalWorkflowExecution(
844844
SignalWorkflowExecutionRequest signalRequest, AsyncMethodCallback resultHandler)
845845
throws TException {
846-
signalRequest.setRequestId(UUID.randomUUID().toString());
847-
ListenableFuture<com.uber.cadence.api.v1.SignalWorkflowExecutionResponse> resultFuture =
848-
grpcServiceStubs
849-
.workflowFutureStub()
850-
.signalWorkflowExecution(RequestMapper.signalWorkflowExecutionRequest(signalRequest));
851-
resultFuture.addListener(
852-
() -> {
853-
try {
854-
com.uber.cadence.api.v1.SignalWorkflowExecutionResponse response = resultFuture.get();
855-
resultHandler.onComplete(null);
856-
} catch (Exception e) {
857-
resultHandler.onError(e);
858-
}
859-
},
860-
ForkJoinPool.commonPool());
846+
try {
847+
signalRequest.setRequestId(UUID.randomUUID().toString());
848+
ListenableFuture<com.uber.cadence.api.v1.SignalWorkflowExecutionResponse> resultFuture =
849+
grpcServiceStubs
850+
.workflowFutureStub()
851+
.signalWorkflowExecution(RequestMapper.signalWorkflowExecutionRequest(signalRequest));
852+
resultFuture.addListener(
853+
() -> {
854+
try {
855+
com.uber.cadence.api.v1.SignalWorkflowExecutionResponse response = resultFuture.get();
856+
resultHandler.onComplete(null);
857+
} catch (Exception e) {
858+
resultHandler.onError(e);
859+
}
860+
},
861+
ForkJoinPool.commonPool());
862+
} catch (StatusRuntimeException e) {
863+
throw ErrorMapper.Error(e);
864+
}
861865
}
862866

863867
@Override

0 commit comments

Comments
 (0)