- if (compareNumbers(min, max) == 1) {
- throw new InferenceException(String.format(
- "Range constraint %s has descending order of boundaries; should be ascending",
- singleRange), ctx.getStatementSourceReference());
- }
- if (boundaries.hasNext()) {
- throw new SourceException(String.format("Wrong number of boundaries in range constraint %s",
- singleRange), ctx.getStatementSourceReference());
- }
+ InferenceException.throwIf(compareNumbers(min, max) == 1, ctx.getStatementSourceReference(),
+ "Range constraint %s has descending order of boundaries; should be ascending", singleRange);
+
+ SourceException.throwIf(boundaries.hasNext(), ctx.getStatementSourceReference(),
+ "Wrong number of boundaries in range constraint %s", singleRange);