Skip to content

Commit

Permalink
Wrap schedule exception
Browse files Browse the repository at this point in the history
  • Loading branch information
Quinn-With-Two-Ns committed Jul 31, 2023
1 parent c2b941a commit 7ef6e23
Showing 1 changed file with 46 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ public void createSchedule(CreateScheduleInput input) {
} else {
throw new ScheduleException(e);
}
} catch (Exception e) {
throw new ScheduleException(e);
}
}

Expand Down Expand Up @@ -153,7 +155,11 @@ public void backfillSchedule(BackfillScheduleInput input) {
.setScheduleId(input.getScheduleId())
.setPatch(patch)
.build();
genericClient.patchSchedule(request);
try {
genericClient.patchSchedule(request);
} catch (Exception e) {
throw new ScheduleException(e);
}
}

@Override
Expand All @@ -164,7 +170,11 @@ public void deleteSchedule(DeleteScheduleInput input) {
.setNamespace(clientOptions.getNamespace())
.setScheduleId(input.getScheduleId())
.build();
genericClient.deleteSchedule(request);
try {
genericClient.deleteSchedule(request);
} catch (Exception e) {
throw new ScheduleException(e);
}
}

@Override
Expand All @@ -175,16 +185,20 @@ public DescribeScheduleOutput describeSchedule(DescribeScheduleInput input) {
.setScheduleId(input.getScheduleId())
.build();

DescribeScheduleResponse response = genericClient.describeSchedule(request);
return new DescribeScheduleOutput(
new ScheduleDescription(
input.getScheduleId(),
scheduleRequestHeader.protoToScheduleInfo(response.getInfo()),
scheduleRequestHeader.protoToSchedule(response.getSchedule()),
Collections.unmodifiableMap(
SearchAttributesUtil.decode(response.getSearchAttributes())),
response.getMemo().getFieldsMap(),
clientOptions.getDataConverter()));
try {
DescribeScheduleResponse response = genericClient.describeSchedule(request);
return new DescribeScheduleOutput(
new ScheduleDescription(
input.getScheduleId(),
scheduleRequestHeader.protoToScheduleInfo(response.getInfo()),
scheduleRequestHeader.protoToSchedule(response.getSchedule()),
Collections.unmodifiableMap(
SearchAttributesUtil.decode(response.getSearchAttributes())),
response.getMemo().getFieldsMap(),
clientOptions.getDataConverter()));
} catch (Exception e) {
throw new ScheduleException(e);
}
}

@Override
Expand All @@ -198,8 +212,11 @@ public void pauseSchedule(PauseScheduleInput input) {
.setScheduleId(input.getScheduleId())
.setPatch(patch)
.build();

genericClient.patchSchedule(request);
try {
genericClient.patchSchedule(request);
} catch (Exception e) {
throw new ScheduleException(e);
}
}

@Override
Expand All @@ -216,7 +233,11 @@ public void triggerSchedule(TriggerScheduleInput input) {
.setScheduleId(input.getScheduleId())
.setPatch(patch)
.build();
genericClient.patchSchedule(request);
try {
genericClient.patchSchedule(request);
} catch (Exception e) {
throw new ScheduleException(e);
}
}

@Override
Expand All @@ -230,7 +251,11 @@ public void unpauseSchedule(UnpauseScheduleInput input) {
.setScheduleId(input.getScheduleId())
.setPatch(patch)
.build();
genericClient.patchSchedule(request);
try {
genericClient.patchSchedule(request);
} catch (Exception e) {
throw new ScheduleException(e);
}
}

@Override
Expand All @@ -249,6 +274,10 @@ public void updateSchedule(UpdateScheduleInput input) {
.setRequestId(UUID.randomUUID().toString())
.setSchedule(scheduleRequestHeader.scheduleToProto(schedule.getSchedule()))
.build();
genericClient.updateSchedule(request);
try {
genericClient.updateSchedule(request);
} catch (Exception e) {
throw new ScheduleException(e);
}
}
}

0 comments on commit 7ef6e23

Please sign in to comment.