From 8c25bc4002aaef9adfaa3c759eab8de41861e6a6 Mon Sep 17 00:00:00 2001 From: Johannes Mockenhaupt Date: Sun, 4 Feb 2018 01:29:27 +0100 Subject: [PATCH] Answers cleanup. --- .../PumpCombo/ruffyscripter/RuffyScripter.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ruffyscripter/RuffyScripter.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ruffyscripter/RuffyScripter.java index 4112306fdd..1020f2bb4f 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ruffyscripter/RuffyScripter.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ruffyscripter/RuffyScripter.java @@ -428,7 +428,7 @@ public class RuffyScripter implements RuffyCommands { Answers.getInstance().logCustom(new CustomEvent("ComboRecoveryFromConnectionLoss") .putCustomAttribute("buildversion", BuildConfig.BUILDVERSION) .putCustomAttribute("version", BuildConfig.VERSION) - .putCustomAttribute("activeCommand", "" + activeCmd) + .putCustomAttribute("activeCommand", "" + (activeCmd != null ? activeCmd.getClass().getSimpleName() : "")) .putCustomAttribute("success", connected ? "true" : "else")); return connected; } @@ -443,7 +443,8 @@ public class RuffyScripter implements RuffyCommands { Answers.getInstance().logCustom(new CustomEvent("ComboRecoveryFromCommandFailure") .putCustomAttribute("buildversion", BuildConfig.BUILDVERSION) .putCustomAttribute("version", BuildConfig.VERSION) - .putCustomAttribute("activeCommand", "" + activeCmd) + .putCustomAttribute("activeCommand", "" + (activeCmd != null ? activeCmd.getClass().getSimpleName() : "")) + .putCustomAttribute("exit", "1") .putCustomAttribute("success", "false")); return new PumpState(); } @@ -461,15 +462,18 @@ public class RuffyScripter implements RuffyCommands { Answers.getInstance().logCustom(new CustomEvent("ComboRecoveryFromCommandFailure") .putCustomAttribute("buildversion", BuildConfig.BUILDVERSION) .putCustomAttribute("version", BuildConfig.VERSION) - .putCustomAttribute("activeCommand", "" + activeCmd) + .putCustomAttribute("activeCommand", "" + (activeCmd != null ? activeCmd.getClass().getSimpleName() : "")) + .putCustomAttribute("exit", "2") .putCustomAttribute("success", "true")); return pumpState; } catch (Exception e) { Answers.getInstance().logCustom(new CustomEvent("ComboRecoveryFromCommandFailure") .putCustomAttribute("buildversion", BuildConfig.BUILDVERSION) .putCustomAttribute("version", BuildConfig.VERSION) - .putCustomAttribute("activeCommand", "" + activeCmd) + .putCustomAttribute("exit", "3") + .putCustomAttribute("activeCommand", "" + (activeCmd != null ? activeCmd.getClass().getSimpleName() : "")) .putCustomAttribute("success", "false")); + log.debug("Reading pump state during recovery failed", e); return new PumpState(); } @@ -494,7 +498,7 @@ public class RuffyScripter implements RuffyCommands { Answers.getInstance().logCustom(new CustomEvent("ComboConnectTimeout") .putCustomAttribute("buildversion", BuildConfig.BUILDVERSION) .putCustomAttribute("version", BuildConfig.VERSION) - .putCustomAttribute("activeCommand", "" + activeCmd) + .putCustomAttribute("activeCommand", "" + (activeCmd != null ? activeCmd.getClass().getSimpleName() : "")) .putCustomAttribute("previousCommand", previousCommand)); throw new CommandException("Timeout connecting to pump"); }