CommandException: provide message for printing.

This commit is contained in:
Johannes Mockenhaupt 2017-07-26 14:35:24 +02:00
parent 0516eacfe5
commit d79b221940
No known key found for this signature in database
GPG key ID: 9E1EA6AF7BBBB0D1
2 changed files with 6 additions and 1 deletions

View file

@ -23,6 +23,11 @@ public class CommandException extends RuntimeException {
return this;
}
@Override
public String getMessage() {
return message;
}
public CommandException message(String message) {
this.message = message;
return this;

View file

@ -172,7 +172,7 @@ public class SetTbrCommand implements Command {
private void verifyDisplayedTbrPercentage(RuffyScripter scripter) {
scripter.verifyMenuIsDisplayed(MenuType.TBR_SET);
long displayedPercentage = readDisplayedTbrPercentage(scripter);
if (displayedPercentage != this.percentage) {
if (displayedPercentage != percentage) {
log.debug("Final displayed TBR percentage: " + displayedPercentage);
throw new CommandException().message("Failed to set TBR percentage");
}