Skip to content

Commit

Permalink
Add error logging when removing empty voice commands and voice comman…
Browse files Browse the repository at this point in the history
…d strings (#1799)

* Add error logging when removing empty commands

* Switch from logging error to logging warnings

* Update warning messages based on PR suggestions
  • Loading branch information
noah-livio authored Mar 25, 2022
1 parent 0f75391 commit 4784a4b
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -217,21 +217,27 @@ List<VoiceCommand> removeEmptyVoiceCommands(List<VoiceCommand> voiceCommands) {
List<VoiceCommand> validatedVoiceCommands = new ArrayList<>();
for (VoiceCommand voiceCommand : voiceCommands) {
if (voiceCommand == null) {
DebugTool.logWarning(TAG, "Voice command is null, it will not be uploaded");
continue;
}
List<String> voiceCommandStrings = new ArrayList<>();
for (String voiceCommandString : voiceCommand.getVoiceCommands()) {
if (voiceCommandString == null) {
DebugTool.logWarning(TAG, "Removing null string from voice command");
continue;
}
String trimmedString = voiceCommandString.trim();
if (trimmedString.length() > 0) {
voiceCommandStrings.add(trimmedString);
} else {
DebugTool.logWarning(TAG, "Empty string removed from voice command");
}
}
if (voiceCommandStrings.size() > 0) {
voiceCommand.setVoiceCommands(voiceCommandStrings);
validatedVoiceCommands.add(voiceCommand);
} else {
DebugTool.logWarning(TAG, "Voice command will not be uploaded as it contained no valid strings");
}
}
return validatedVoiceCommands;
Expand Down

0 comments on commit 4784a4b

Please sign in to comment.