Keep startup errors

This commit is contained in:
2026-03-13 14:18:34 -06:00
parent 462e37a443
commit 1e381d59c6

View File

@@ -25,6 +25,7 @@ public class DevStackApplication {
CountDownLatch shutdownLatch = new CountDownLatch(1);
ScheduledExecutorService scheduler = null;
AtomicBoolean shuttingDown = new AtomicBoolean(false);
RuntimeException startupFailure = null;
try {
validateJavaVersion();
@@ -42,6 +43,7 @@ public class DevStackApplication {
scheduler = startDatabaseWatch(docker, context, shuttingDown);
shutdownLatch.await();
} catch (RuntimeException ex) {
startupFailure = ex;
throw new IllegalStateException(describeStartupFailure(ex), ex);
} catch (InterruptedException ex) {
Thread.currentThread().interrupt();
@@ -54,7 +56,15 @@ public class DevStackApplication {
context.close();
}
if (!shuttingDown.get()) {
docker.stopDatabase();
try {
docker.stopDatabase();
} catch (RuntimeException stopFailure) {
if (startupFailure != null) {
System.err.println(stopFailure.getMessage());
} else {
throw stopFailure;
}
}
}
}
}