From 4b5df855e1a3e0d13dc70cef6dea637361959a88 Mon Sep 17 00:00:00 2001 From: rammohan-y <37395033+rammohan-y@users.noreply.github.com> Date: Tue, 29 Oct 2024 17:04:49 +0530 Subject: [PATCH] feat/952: removed unnecessary condition which is not logging the target_sid (#953) --- lib/tasks/say.js | 36 +++++++++++++----------------------- 1 file changed, 13 insertions(+), 23 deletions(-) diff --git a/lib/tasks/say.js b/lib/tasks/say.js index 241a3f93..f1d3ad3b 100644 --- a/lib/tasks/say.js +++ b/lib/tasks/say.js @@ -177,32 +177,22 @@ class TaskSay extends TtsTask { account_sid, alert_type: AlertType.TTS_FAILURE, vendor, - detail: evt.variable_tts_error + detail: evt.variable_tts_error, + target_sid }).catch((err) => this.logger.info({err}, 'Error generating alert for no tts')); } - else { - this.logger.debug({evt}, 'Say got playback-stop'); - if (evt.variable_tts_error) { - writeAlerts({ - account_sid, - alert_type: AlertType.TTS_FAILURE, - vendor, - detail: evt.variable_tts_error, - target_sid - }).catch((err) => this.logger.info({err}, 'Error generating alert for no tts')); - } - if (evt.variable_tts_cache_filename && !this.killed) { - const text = parseTextFromSayString(this.text[segment]); - addFileToCache(evt.variable_tts_cache_filename, { - account_sid, - vendor, - language, - voice, - engine, - text - }).catch((err) => this.logger.info({err}, 'Error adding file to cache')); - } + if (evt.variable_tts_cache_filename && !this.killed) { + const text = parseTextFromSayString(this.text[segment]); + addFileToCache(evt.variable_tts_cache_filename, { + account_sid, + vendor, + language, + voice, + engine, + text + }).catch((err) => this.logger.info({err}, 'Error adding file to cache')); } + if (this._playResolve) { evt.variable_tts_error ? this._playReject(new Error(evt.variable_tts_error)) : this._playResolve(); }