fix: wrong stt vendor will raise ws notification (#219)

* fix: wrong stt vendor will raise ws notification

* fix: wrong stt vendor will raise ws notification

Co-authored-by: Quan HL <quan.luuhoan8@gmail.com>
This commit is contained in:
Hoan Luu Huu
2023-01-17 19:52:05 +07:00
committed by GitHub
parent 567b03fd36
commit 028aeea856

View File

@@ -162,8 +162,10 @@ class TaskGather extends Task {
alert_type: AlertType.STT_NOT_PROVISIONED,
vendor: this.vendor
}).catch((err) => this.logger.info({err}, 'Error generating alert for no stt'));
throw new Error(`no speech-to-text service credentials for ${this.vendor} have been configured`);
// Notify application that STT vender is wrong.
this.notifyError(`No speech-to-text service credentials for ${this.vendor} have been configured`);
this.notifyTaskDone();
throw new Error(`No speech-to-text service credentials for ${this.vendor} have been configured`);
}
this.logger.info({sttCredentials: this.sttCredentials}, 'Gather:exec - sttCredentials');
@@ -385,6 +387,8 @@ class TaskGather extends Task {
break;
default:
this.notifyError(`Invalid vendor ${this.vendor}`);
this.notifyTaskDone();
throw new Error(`Invalid vendor ${this.vendor}`);
}