code clean RuntimeExceptions
This commit is contained in:
parent
dfc374b13a
commit
27d827b9d6
@ -53,7 +53,7 @@ public enum Alignment {
|
||||
} else if (this.amount instanceof final Period period) {
|
||||
return period.multipliedBy((int) amount);
|
||||
}
|
||||
throw new RuntimeException();
|
||||
throw new RuntimeException("Cannot multiply unimplemented TemporalAmount: %s".formatted(this.amount));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -14,7 +14,7 @@ public class GraphPoint {
|
||||
@NonNull
|
||||
public GraphPoint plus(@NonNull final GraphPoint other) {
|
||||
if (this.date.compareTo(other.date) != 0) {
|
||||
throw new RuntimeException();
|
||||
throw new RuntimeException("Cannot 'add' GraphPoints with different dates: this=%s, other=%s".formatted(this, other));
|
||||
}
|
||||
return new GraphPoint(date, value + other.value);
|
||||
}
|
||||
|
||||
@ -31,10 +31,8 @@ public abstract class MeterValue {
|
||||
|
||||
public void update(@NonNull final Value value) {
|
||||
final double converted = value.as(id.getMeter().getSeries().getUnit()).value;
|
||||
if (converted < this.max) {
|
||||
throw new RuntimeException();
|
||||
}
|
||||
this.max = converted;
|
||||
this.min = Math.min(this.min, converted);
|
||||
this.max = Math.max(this.max, converted);
|
||||
}
|
||||
|
||||
@Data
|
||||
|
||||
Loading…
Reference in New Issue
Block a user