20: Handle missing variables gracefully
This commit is contained in:
@@ -22,9 +22,19 @@ public final class PriceAlarm {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
BigDecimal target = AlarmTargetParser.parse(
|
BigDecimal target;
|
||||||
|
try {
|
||||||
|
target = AlarmTargetParser.parse(
|
||||||
variableResolver.resolve(definition.targetExpression())
|
variableResolver.resolve(definition.targetExpression())
|
||||||
);
|
);
|
||||||
|
} catch (RuntimeException exception) {
|
||||||
|
System.err.printf(
|
||||||
|
"Could not resolve target for alarm %d: %s%n",
|
||||||
|
definition.id(),
|
||||||
|
exception.getMessage()
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
boolean reached = definition.direction().reached(
|
boolean reached = definition.direction().reached(
|
||||||
price.priceUsd(),
|
price.priceUsd(),
|
||||||
|
|||||||
Reference in New Issue
Block a user