Skip to content

Commit 50e8830

Browse files
authored
handle search attributes errors (#698)
1 parent 2fc28ab commit 50e8830

File tree

1 file changed

+27
-15
lines changed

1 file changed

+27
-15
lines changed

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

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -568,33 +568,45 @@ public ListWorkflowExecutionsResponse ScanWorkflowExecutions(
568568
ListWorkflowExecutionsRequest listRequest)
569569
throws BadRequestError, EntityNotExistsError, ServiceBusyError,
570570
ClientVersionNotSupportedError, TException {
571-
com.uber.cadence.api.v1.ScanWorkflowExecutionsResponse response =
572-
grpcServiceStubs
573-
.visibilityBlockingStub()
574-
.scanWorkflowExecutions(RequestMapper.scanWorkflowExecutionsRequest(listRequest));
575-
return ResponseMapper.scanWorkflowExecutionsResponse(response);
571+
try {
572+
com.uber.cadence.api.v1.ScanWorkflowExecutionsResponse response =
573+
grpcServiceStubs
574+
.visibilityBlockingStub()
575+
.scanWorkflowExecutions(RequestMapper.scanWorkflowExecutionsRequest(listRequest));
576+
return ResponseMapper.scanWorkflowExecutionsResponse(response);
577+
} catch (StatusRuntimeException e) {
578+
throw ErrorMapper.Error(e);
579+
}
576580
}
577581

578582
@Override
579583
public CountWorkflowExecutionsResponse CountWorkflowExecutions(
580584
CountWorkflowExecutionsRequest countRequest)
581585
throws BadRequestError, EntityNotExistsError, ServiceBusyError,
582586
ClientVersionNotSupportedError, TException {
583-
com.uber.cadence.api.v1.CountWorkflowExecutionsResponse response =
584-
grpcServiceStubs
585-
.visibilityBlockingStub()
586-
.countWorkflowExecutions(RequestMapper.countWorkflowExecutionsRequest(countRequest));
587-
return ResponseMapper.countWorkflowExecutionsResponse(response);
587+
try {
588+
com.uber.cadence.api.v1.CountWorkflowExecutionsResponse response =
589+
grpcServiceStubs
590+
.visibilityBlockingStub()
591+
.countWorkflowExecutions(RequestMapper.countWorkflowExecutionsRequest(countRequest));
592+
return ResponseMapper.countWorkflowExecutionsResponse(response);
593+
} catch (StatusRuntimeException e) {
594+
throw ErrorMapper.Error(e);
595+
}
588596
}
589597

590598
@Override
591599
public GetSearchAttributesResponse GetSearchAttributes()
592600
throws ServiceBusyError, ClientVersionNotSupportedError, TException {
593-
com.uber.cadence.api.v1.GetSearchAttributesResponse response =
594-
grpcServiceStubs
595-
.visibilityBlockingStub()
596-
.getSearchAttributes(GetSearchAttributesRequest.newBuilder().build());
597-
return ResponseMapper.getSearchAttributesResponse(response);
601+
try {
602+
com.uber.cadence.api.v1.GetSearchAttributesResponse response =
603+
grpcServiceStubs
604+
.visibilityBlockingStub()
605+
.getSearchAttributes(GetSearchAttributesRequest.newBuilder().build());
606+
return ResponseMapper.getSearchAttributesResponse(response);
607+
} catch (StatusRuntimeException e) {
608+
throw ErrorMapper.Error(e);
609+
}
598610
}
599611

600612
@Override

0 commit comments

Comments
 (0)