Skip to content

Commit 539916b

Browse files
Copilotbachuv
andauthored
Add explicit TimeoutException rethrow in waitForInstanceStart, waitForInstanceCompletion, purgeInstances
Update rethrow logic after toException translation to check TimeoutException first, then RuntimeException, with defensive fallback as last resort. Agent-Logs-Url: https://github.com/microsoft/durabletask-java/sessions/2852d301-7a07-419c-a4f5-036184610079 Co-authored-by: bachuv <15795068+bachuv@users.noreply.github.com>
1 parent a4fe62f commit 539916b

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

client/src/main/java/com/microsoft/durabletask/DurableTaskGrpcClient.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,9 @@ public OrchestrationMetadata waitForInstanceStart(String instanceId, Duration ti
227227
throw new TimeoutException("Start orchestration timeout reached.");
228228
}
229229
Exception translated = StatusRuntimeExceptionHelper.toException(e, "waitForInstanceStart");
230-
if (translated instanceof RuntimeException) {
230+
if (translated instanceof TimeoutException) {
231+
throw (TimeoutException) translated;
232+
} else if (translated instanceof RuntimeException) {
231233
throw (RuntimeException) translated;
232234
}
233235
throw new RuntimeException(translated);
@@ -258,7 +260,9 @@ public OrchestrationMetadata waitForInstanceCompletion(String instanceId, Durati
258260
throw new TimeoutException("Orchestration instance completion timeout reached.");
259261
}
260262
Exception translated = StatusRuntimeExceptionHelper.toException(e, "waitForInstanceCompletion");
261-
if (translated instanceof RuntimeException) {
263+
if (translated instanceof TimeoutException) {
264+
throw (TimeoutException) translated;
265+
} else if (translated instanceof RuntimeException) {
262266
throw (RuntimeException) translated;
263267
}
264268
throw new RuntimeException(translated);
@@ -370,7 +374,9 @@ public PurgeResult purgeInstances(PurgeInstanceCriteria purgeInstanceCriteria) t
370374
throw new TimeoutException(timeOutException);
371375
}
372376
Exception translated = StatusRuntimeExceptionHelper.toException(e, "purgeInstances");
373-
if (translated instanceof RuntimeException) {
377+
if (translated instanceof TimeoutException) {
378+
throw (TimeoutException) translated;
379+
} else if (translated instanceof RuntimeException) {
374380
throw (RuntimeException) translated;
375381
}
376382
throw new RuntimeException(translated);

0 commit comments

Comments
 (0)