Fix: exceptions inside CommandOutcomes are not reported by Bootique
@@ -381,6 +381,10 @@ public class Bootique {
} else {
bootLogger.stderr(String.format("Error running command '%s'", getArgsAsString()));
}
+ if (o.getException() != null) {
+ // exception unrecognized, dump the details for users to analyze..
+ bootLogger.stderr("Command exception: ", o.getException());
+ }
}
return o;
@@ -418,9 +422,6 @@ public class Bootique {
return th == parentTh ? o : CommandOutcome.failed(o.getExitCode(), o.getMessage(), parentTh);
}
- // exception unrecognized, dump the details for users to analyze..
- bootLogger.stderr("Command exception: ", parentTh);
-
String thMessage = th != null ? th.getMessage() : null;
String message = thMessage != null ? "Command exception: '" + thMessage + "'." : "Command exception.";
return CommandOutcome.failed(1, message, parentTh);
