Allow Say, Gather, Transcribe is able to finished if there is error for speech credential (#910)

* allow move to next task if say verb is failed because of speech credential

* allow move to next task if say verb is failed because of speech credential

* allow move to next task if say verb is failed because of speech credential

* wip

* wip
This commit is contained in:
Hoan Luu Huu
2024-10-02 00:40:41 +07:00
committed by GitHub
parent b898b70520
commit 96b3b0fe07
6 changed files with 65 additions and 8 deletions

View File

@@ -1,5 +1,6 @@
const Task = require('./task');
const { TaskPreconditions } = require('../utils/constants');
const { SpeechCredentialError } = require('../utils/error');
class TtsTask extends Task {
@@ -52,7 +53,8 @@ class TtsTask extends Task {
let credentials = cs.getSpeechCredentials(vendor, 'tts', label);
if (!credentials) {
throw new Error(`No text-to-speech service credentials for ${vendor} with labels: ${label} have been configured`);
throw new SpeechCredentialError(
`No text-to-speech service credentials for ${vendor} with labels: ${label} have been configured`);
}
/* parse Nuance voices into name and model */
let model;
@@ -124,7 +126,7 @@ class TtsTask extends Task {
vendor,
target_sid: cs.callSid
}).catch((err) => this.logger.info({err}, 'Error generating alert for no tts'));
throw new Error('no provisioned speech credentials for TTS');
throw new SpeechCredentialError('no provisioned speech credentials for TTS');
}
// synthesize all of the text elements
let lastUpdated = false;