2: Swap System.exit from JupiterPerpsAlarmImpl with thrown exceptions
This commit is contained in:
@@ -16,10 +16,9 @@ public final class JupiterPerpsAlarmImpl {
|
|||||||
try {
|
try {
|
||||||
config = Config.parse(args, System.getenv());
|
config = Config.parse(args, System.getenv());
|
||||||
} catch (IllegalArgumentException exception) {
|
} catch (IllegalArgumentException exception) {
|
||||||
System.err.println(exception.getMessage());
|
|
||||||
printUsage();
|
printUsage();
|
||||||
System.exit(2);
|
String errMsg = "Could not parse configuration for JupiterPerpsAlarm: " + exception.getMessage() + "!";
|
||||||
return;
|
throw new IllegalStateException(errMsg, exception);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.selfTest()) {
|
if (config.selfTest()) {
|
||||||
@@ -32,9 +31,8 @@ public final class JupiterPerpsAlarmImpl {
|
|||||||
try {
|
try {
|
||||||
definitions = AlarmConfigurationParser.parse(config.alarmConfiguration());
|
definitions = AlarmConfigurationParser.parse(config.alarmConfiguration());
|
||||||
} catch (Exception exception) {
|
} catch (Exception exception) {
|
||||||
System.err.println("Could not load alarm configuration: " + exception.getMessage());
|
String errMsg = "Could not load alarm configuration: " + exception.getMessage() + "!";
|
||||||
System.exit(2);
|
throw new IllegalStateException(errMsg, exception);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
List<AlarmAction> actions = new ArrayList<>();
|
List<AlarmAction> actions = new ArrayList<>();
|
||||||
|
|||||||
Reference in New Issue
Block a user