Skip to content

Commit

Permalink
Fix authentication after communication error (#15747)
Browse files Browse the repository at this point in the history
Fixes #15746

Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
  • Loading branch information
jlaur committed Oct 16, 2023
1 parent fb86e05 commit 04bbbbb
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -328,14 +328,16 @@ public byte[] synthesizeSpeech(String text, GoogleTTSVoice voice, String codec)
String format = getFormatForCodec(codec);
try {
return synthesizeSpeechByGoogle(text, voice, format);
} catch (AuthenticationException | CommunicationException e) {
logger.warn("Error initializing Google Cloud TTS service: {}", e.getMessage());
} catch (AuthenticationException e) {
logger.warn("Error authenticating Google Cloud TTS service: {}", e.getMessage());
if (oAuthService != null) {
oAuthFactory.ungetOAuthService(GoogleTTSService.SERVICE_PID);
oAuthService = null;
}
voices.clear();
} catch (CommunicationException e) {
logger.warn("Error initializing Google Cloud TTS service: {}", e.getMessage());
}
voices.clear();
return null;
}

Expand Down

0 comments on commit 04bbbbb

Please sign in to comment.