diff --git a/src/main/kotlin/com/beust/kobalt/internal/DynamicGraph.kt b/src/main/kotlin/com/beust/kobalt/internal/DynamicGraph.kt index 3742c058..0982af66 100644 --- a/src/main/kotlin/com/beust/kobalt/internal/DynamicGraph.kt +++ b/src/main/kotlin/com/beust/kobalt/internal/DynamicGraph.kt @@ -76,9 +76,14 @@ public class DynamicGraphExecutor(val graph: DynamicGraph, } catch(ex: TimeoutException) { log(2, "Time out") } catch(ex: Exception) { - if (ex.cause is InvocationTargetException - && (ex.cause as InvocationTargetException).targetException is KobaltException) { - throw (ex.cause as InvocationTargetException).targetException + if (ex.cause is InvocationTargetException) { + val ite = ex.cause + if (ite.targetException is KobaltException) { + throw (ex.cause as InvocationTargetException).targetException + } else { + error("Error: ${ite.cause?.message}", ite.cause) + gotError = true + } } else { error("Error: ${ex.message}", ex) gotError = true