Skip to content
Open
Prev Previous commit
Next Next commit
refactor: narrow the workflow exception constructors back to package-…
…private

Splitting the folded durable task types into subpackages moved the
executor away from the exceptions it constructs, and the visibility was
widened to compensate. It was widened further than the split required:
every constructor on both classes became public where only the two the
executor actually calls needed to be.

Restore the rest to package-private, matching what they were before the
merge. The two that stay public are the ones the executor constructs from
io.dapr.workflows.task.internal, and their javadoc now says so accurately
— the previous note claimed a sibling-package caller for members that
have none.

No test used any of these constructors, and no behaviour changes.

Signed-off-by: Javier Aliaga <javier@diagrid.io>
  • Loading branch information
javier-aliaga committed Oct 14, 2026
commit 9277f303b035064edf53c4e486bca5063b7b18c8
Original file line number Diff line number Diff line change
Expand Up @@ -28,31 +28,40 @@
public class CompositeTaskFailedException extends RuntimeException {
private final List<Exception> exceptions;

public CompositeTaskFailedException() {
CompositeTaskFailedException() {
this.exceptions = new ArrayList<>();
}

public CompositeTaskFailedException(List<Exception> exceptions) {
CompositeTaskFailedException(List<Exception> exceptions) {
this.exceptions = exceptions;
}

/**
* Creates a composite failure from the tasks that failed.
*
* <p>Public because the workflow executor constructs it from another package. Not intended for
* application code.
*
* @param message the exception message.
* @param exceptions the individual task failures.
*/
public CompositeTaskFailedException(String message, List<Exception> exceptions) {
super(message);
this.exceptions = exceptions;
}

public CompositeTaskFailedException(String message, Throwable cause, List<Exception> exceptions) {
CompositeTaskFailedException(String message, Throwable cause, List<Exception> exceptions) {
super(message, cause);
this.exceptions = exceptions;
}

public CompositeTaskFailedException(Throwable cause, List<Exception> exceptions) {
CompositeTaskFailedException(Throwable cause, List<Exception> exceptions) {
super(cause);
this.exceptions = exceptions;
}

public CompositeTaskFailedException(String message, Throwable cause, boolean enableSuppression,
boolean writableStackTrace, List<Exception> exceptions) {
CompositeTaskFailedException(String message, Throwable cause, boolean enableSuppression,
boolean writableStackTrace, List<Exception> exceptions) {
super(message, cause, enableSuppression, writableStackTrace);
this.exceptions = exceptions;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,21 @@ public class TaskFailedException extends RuntimeException {
private final String taskName;
private final int taskId;

public TaskFailedException(String taskName, int taskId, WorkflowFailureDetails details) {
this(getExceptionMessage(taskName, taskId, details), taskName, taskId, details);
}

/**
* Creates a task failure with an explicit message.
* Creates a task failure with a message derived from the task and failure details.
*
* <p>Public so the workflow executor in a sibling package can reach it; not intended for
* <p>Public because the workflow executor constructs it from another package. Not intended for
* application code.
*
* @param message the exception message.
* @param taskName the name of the failed task.
* @param taskId the id of the failed task.
* @param details details of the failure.
*/
public TaskFailedException(String message, String taskName, int taskId, WorkflowFailureDetails details) {
public TaskFailedException(String taskName, int taskId, WorkflowFailureDetails details) {
this(getExceptionMessage(taskName, taskId, details), taskName, taskId, details);
}

TaskFailedException(String message, String taskName, int taskId, WorkflowFailureDetails details) {
super(message);
this.taskName = taskName;
this.taskId = taskId;
Expand Down