2: Swap System.exit from JupiterPerpsAlarmImpl with thrown exceptions

This commit is contained in:
2026-06-19 09:51:05 +02:00
parent dbdde7b7e3
commit 641cf3d2d4
@@ -16,10 +16,9 @@ public final class JupiterPerpsAlarmImpl {
try {
config = Config.parse(args, System.getenv());
} catch (IllegalArgumentException exception) {
System.err.println(exception.getMessage());
printUsage();
System.exit(2);
return;
String errMsg = "Could not parse configuration for JupiterPerpsAlarm: " + exception.getMessage() + "!";
throw new IllegalStateException(errMsg, exception);
}
if (config.selfTest()) {
@@ -32,9 +31,8 @@ public final class JupiterPerpsAlarmImpl {
try {
definitions = AlarmConfigurationParser.parse(config.alarmConfiguration());
} catch (Exception exception) {
System.err.println("Could not load alarm configuration: " + exception.getMessage());
System.exit(2);
return;
String errMsg = "Could not load alarm configuration: " + exception.getMessage() + "!";
throw new IllegalStateException(errMsg, exception);
}
List<AlarmAction> actions = new ArrayList<>();