Merge pull request #14 from samspycher/tbr_duration_validation
throw IllegalArgumentException for zero or negative durations
This commit is contained in:
commit
47f94ce2d8
1 changed files with 4 additions and 1 deletions
|
@ -27,7 +27,10 @@ public class TempBasalExtraCommand extends MessageBlock {
|
|||
} else if (rate > OmnipodConstants.MAX_BASAL_RATE) {
|
||||
throw new IllegalArgumentException("Rate exceeds max basal rate");
|
||||
}
|
||||
if (duration.isLongerThan(OmnipodConstants.MAX_TEMP_BASAL_DURATION)) {
|
||||
|
||||
if (duration.isShorterThan(Duration.ZERO) || duration.equals(Duration.ZERO)) {
|
||||
throw new IllegalArgumentException("Duration should be > 0");
|
||||
} else if (duration.isLongerThan(OmnipodConstants.MAX_TEMP_BASAL_DURATION)) {
|
||||
throw new IllegalArgumentException("Duration exceeds max temp basal duration");
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue