From b08790cf508966490a09f755d2d520a6493be8e1 Mon Sep 17 00:00:00 2001 From: Cedric Beust Date: Sun, 15 Nov 2015 21:27:05 -0800 Subject: [PATCH] Better error reporting. --- .../kotlin/com/beust/kobalt/internal/DynamicGraph.kt | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) 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