Return original exception in case retry fails as well.

This commit is contained in:
Johannes Mockenhaupt 2017-07-22 01:44:34 +02:00
parent d0d3e46e03
commit e45acab420
No known key found for this signature in database
GPG key ID: 9E1EA6AF7BBBB0D1

View file

@ -390,7 +390,7 @@ public class ComboPlugin implements PluginBase, PumpInterface {
MainApp.bus().post(new EventComboPumpUpdateGUI()); MainApp.bus().post(new EventComboPumpUpdateGUI());
CommandResult commandResult = ruffyScripter.runCommand(command); CommandResult commandResult = ruffyScripter.runCommand(command);
if (commandResult.exception != null) { if (!commandResult.success && commandResult.exception != null) {
log.error("CommandResult has exception, rebinding ruffy service", commandResult.exception); log.error("CommandResult has exception, rebinding ruffy service", commandResult.exception);
unbindRuffyService(); unbindRuffyService();
@ -400,13 +400,14 @@ public class ComboPlugin implements PluginBase, PumpInterface {
if (ruffyScripter == null) { if (ruffyScripter == null) {
log.error("Rebinding failed"); log.error("Rebinding failed");
} } else if (!commandResult.enacted && !(command instanceof BolusCommand)) {
// retry command, but make sure it wasn't enacted and don't retry // retry command, but make sure it wasn't enacted and don't retry
// bolus commands (user is interacting with AAPS right now so he can // bolus commands (user is interacting with AAPS right now so he can
// deal with it and we don't want to deliver a bolus twice // deal with it and we don't want to deliver a bolus twice)
if (!commandResult.enacted && !(command instanceof BolusCommand)) { CommandResult retriedCommandResult = ruffyScripter.runCommand(command);
commandResult = ruffyScripter.runCommand(command) ; if (retriedCommandResult.success) {
commandResult = retriedCommandResult;
}
} }
} }