Make CancelTbrCommand more robust.
This commit is contained in:
parent
30fc385970
commit
0345a01fc1
1 changed files with 14 additions and 10 deletions
|
@ -13,6 +13,7 @@ public class CancelTbrCommand implements Command {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CommandResult execute(RuffyScripter scripter) {
|
public CommandResult execute(RuffyScripter scripter) {
|
||||||
|
try {
|
||||||
scripter.verifyMenuIsDisplayed(MenuType.MAIN_MENU);
|
scripter.verifyMenuIsDisplayed(MenuType.MAIN_MENU);
|
||||||
Double tbrPercentage = (Double) scripter.currentMenu.getAttribute(MenuAttribute.TBR);
|
Double tbrPercentage = (Double) scripter.currentMenu.getAttribute(MenuAttribute.TBR);
|
||||||
boolean runtimeDisplayed = scripter.currentMenu.attributes().contains(MenuAttribute.RUNTIME);
|
boolean runtimeDisplayed = scripter.currentMenu.attributes().contains(MenuAttribute.RUNTIME);
|
||||||
|
@ -24,6 +25,9 @@ public class CancelTbrCommand implements Command {
|
||||||
.message("No TBR active");
|
.message("No TBR active");
|
||||||
}
|
}
|
||||||
log.debug("Cancelling active TBR of " + tbrPercentage + "% with " + runtimeDisplayed + "min remaining");
|
log.debug("Cancelling active TBR of " + tbrPercentage + "% with " + runtimeDisplayed + "min remaining");
|
||||||
|
} catch (CommandException e) {
|
||||||
|
return e.toCommandResult();
|
||||||
|
}
|
||||||
return new SetTbrCommand(100, 0).execute(scripter);
|
return new SetTbrCommand(100, 0).execute(scripter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue