Fix authentication after communication error (#15747)

Fixes #15746

Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
This commit is contained in:
Jacob Laursen 2023-10-16 20:07:52 +02:00 committed by GitHub
parent d2b3f68d2e
commit eadfd58cd1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 3 deletions

View File

@ -328,14 +328,16 @@ class GoogleCloudAPI {
String format = getFormatForCodec(codec); String format = getFormatForCodec(codec);
try { try {
return synthesizeSpeechByGoogle(text, voice, format); return synthesizeSpeechByGoogle(text, voice, format);
} catch (AuthenticationException | CommunicationException e) { } catch (AuthenticationException e) {
logger.warn("Error initializing Google Cloud TTS service: {}", e.getMessage()); logger.warn("Error authenticating Google Cloud TTS service: {}", e.getMessage());
if (oAuthService != null) { if (oAuthService != null) {
oAuthFactory.ungetOAuthService(GoogleTTSService.SERVICE_PID); oAuthFactory.ungetOAuthService(GoogleTTSService.SERVICE_PID);
oAuthService = null; oAuthService = null;
} }
voices.clear(); } catch (CommunicationException e) {
logger.warn("Error initializing Google Cloud TTS service: {}", e.getMessage());
} }
voices.clear();
return null; return null;
} }