Skip to content

Commit

Permalink
Fix exception handling in local executor [ci fast]
Browse files Browse the repository at this point in the history
Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
  • Loading branch information
pditommaso committed Apr 5, 2024
1 parent 01447d5 commit 74d7d7a
Showing 1 changed file with 8 additions and 3 deletions.
Expand Up @@ -17,6 +17,7 @@

package nextflow.executor.local

import java.lang.reflect.InvocationTargetException
import java.util.concurrent.Callable
import java.util.concurrent.Future

Expand Down Expand Up @@ -91,11 +92,15 @@ class NativeTaskHandler extends TaskHandler {
boolean checkIfCompleted() {
if( isRunning() && result.isDone() ) {
status = TaskStatus.COMPLETED
if( result.get() instanceof Throwable ) {
task.error = (Throwable)result.get()
final ret = result.get()
if( ret instanceof InvocationTargetException ) {
task.error = ret.cause
}
else if( ret instanceof Throwable ) {
task.error = (Throwable)ret
}
else {
task.stdout = result.get()
task.stdout = ret
}
return true
}
Expand Down

0 comments on commit 74d7d7a

Please sign in to comment.