microsoft / durabletask-java

Java SDK for Durable Functions and the Durable Task Framework
MIT License
13 stars 7 forks source link

TaskOrchestrationContext.allOf should throw TaskFailureException instead of RuntimeException #54

Closed cgillum closed 1 year ago

cgillum commented 2 years ago

The implementation of this method in TaskOrchestrationExecutor.java currently throws a RuntimeException if any of the inner tasks fails. This seems wrong because tasks are only supposed to fail with TaskFailedException.

One challenge is that TaskFailedException is designed to represent a single named task. We may need to create a new exception type for composite exceptions. Alternatively, we could surface the details of the first exception. It may be useful to use the current .NET implementation design as a reference for this design.

As part of this work item, we should also do the following:

davidmrdavid commented 2 years ago

If we're just returning the exception of one of the inner tasks, why should we use a new class representing a "composite" exception?

cgillum commented 2 years ago

If we're just returning the exception of one of the inner tasks, why should we use a new class representing a "composite" exception?

These are alternate proposals. We could either a) introduce composite exceptions or b) surface only the first exception. We wouldn't do both.