use of com.uber.cadence.internal.replay.ChildWorkflowTaskFailedException in project cadence-client by uber-java.
the class SyncDecisionContext method mapChildWorkflowException.
private RuntimeException mapChildWorkflowException(Exception failure) {
if (failure == null) {
return null;
}
if (failure instanceof CancellationException) {
return (CancellationException) failure;
}
if (failure instanceof ChildWorkflowException) {
throw (ChildWorkflowException) failure;
}
if (!(failure instanceof ChildWorkflowTaskFailedException)) {
throw new IllegalArgumentException("Unexpected exception type: ", failure);
}
ChildWorkflowTaskFailedException taskFailed = (ChildWorkflowTaskFailedException) failure;
String causeClassName = taskFailed.getReason();
Exception cause;
try {
@SuppressWarnings("unchecked") Class<? extends Exception> causeClass = (Class<? extends Exception>) Class.forName(causeClassName);
cause = getDataConverter().fromData(taskFailed.getDetails(), causeClass);
} catch (Exception e) {
cause = e;
}
return new ChildWorkflowFailureException(taskFailed.getEventId(), taskFailed.getWorkflowExecution(), taskFailed.getWorkflowType(), cause);
}
Aggregations