Skip to content

Commit

Permalink
Fix format specifiers when adding invalid choices
Browse files Browse the repository at this point in the history
  • Loading branch information
freya022 committed Mar 10, 2024
1 parent 6ed55cf commit aba59a2
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,21 +69,21 @@ public AutoCompleteCallbackAction addChoices(@Nonnull Collection<Command.Choice>
"Choice of type %s cannot be converted to INTEGER", choice.getType());
long valueLong = choice.getAsLong();
Checks.check(valueLong <= OptionData.MAX_POSITIVE_NUMBER,
"Choice value cannot be larger than %d Provided: %d",
"Choice value cannot be larger than %f Provided: %d",
OptionData.MAX_POSITIVE_NUMBER, valueLong);
Checks.check(valueLong >= OptionData.MIN_NEGATIVE_NUMBER,
"Choice value cannot be smaller than %d. Provided: %d",
"Choice value cannot be smaller than %f. Provided: %d",
OptionData.MIN_NEGATIVE_NUMBER, valueLong);
break;
case NUMBER:
Checks.check(choice.getType() == OptionType.NUMBER || choice.getType() == OptionType.INTEGER,
"Choice of type %s cannot be converted to NUMBER", choice.getType());
double valueDouble = choice.getAsDouble();
Checks.check(valueDouble <= OptionData.MAX_POSITIVE_NUMBER,
"Choice value cannot be larger than %d Provided: %d",
"Choice value cannot be larger than %f Provided: %f",
OptionData.MAX_POSITIVE_NUMBER, valueDouble);
Checks.check(valueDouble >= OptionData.MIN_NEGATIVE_NUMBER,
"Choice value cannot be smaller than %d. Provided: %d",
"Choice value cannot be smaller than %f. Provided: %f",
OptionData.MIN_NEGATIVE_NUMBER, valueDouble);
break;
case STRING:
Expand Down

0 comments on commit aba59a2

Please sign in to comment.