Skip to content

Commit

Permalink
Throw exception so that it has to be handled or logged.
Browse files Browse the repository at this point in the history
To avoid that the exception is swallowed in case there's no ManagedTask listener.
Also add the original exception as the cause to add it to the stacktrace.
Signed-off-by:Ondro Mihalyi <mihalyi@omnifish.ee>
  • Loading branch information
OndroMih committed Mar 3, 2024
1 parent b141018 commit f78a7c8
Showing 1 changed file with 2 additions and 1 deletion.
Expand Up @@ -245,13 +245,14 @@ public String getTaskIdentityName() {
private void abort() {
// Context handle not in valid state, throws AbortedException and
// do not run the task
AbortedException ex = new AbortedException(contextSetupException.getMessage());
AbortedException ex = new AbortedException(contextSetupException.getMessage(), contextSetupException);
setException(ex);
if (taskListener != null) {
// notify listener. No need to set context here as it wouldn't work
// anyway
taskListener.taskAborted(this, executor.getExecutorForTaskListener(), task, ex);
}
throw new RuntimeException(ex);
}

}

0 comments on commit f78a7c8

Please sign in to comment.