mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-21 17:17:58 +00:00
add more error logs
This commit is contained in:
@@ -68,17 +68,17 @@ class Cognigy extends Task {
|
||||
rejector = reject;
|
||||
});
|
||||
this.taskQueue.push(async(cb) => {
|
||||
this.logger.info("EXECUTING SAY TASK");
|
||||
this.logger.info('EXECUTING SAY TASK');
|
||||
try {
|
||||
const result = await task();
|
||||
resolver(result);
|
||||
cb(result);
|
||||
} catch (err) {
|
||||
this.logger.error({err}, "could not execute task in task queue");
|
||||
this.logger.error({err}, 'could not execute task in task queue');
|
||||
rejector(err);
|
||||
cb(err);
|
||||
}
|
||||
this.logger.info("SAY TASK EXECUTED");
|
||||
this.logger.info('SAY TASK EXECUTED');
|
||||
});
|
||||
this.taskQueue.lastPromise = taskPromise;
|
||||
return taskPromise;
|
||||
@@ -154,8 +154,13 @@ class Cognigy extends Task {
|
||||
this.client.removeAllListeners();
|
||||
if (this.client && this.client.connected) this.client.disconnect();
|
||||
|
||||
// end the task queue AFTER we have removed all listeneres since now we cannot get new stuff inside the queue
|
||||
this.taskQueue.end();
|
||||
try {
|
||||
// end the task queue AFTER we have removed all listeneres since now we cannot get new stuff inside the queue
|
||||
this.taskQueue.end();
|
||||
} catch (err) {
|
||||
this.logger.error({err}, 'could not end tasks queue!!');
|
||||
}
|
||||
|
||||
|
||||
if (!this.hasReportedFinalAction) {
|
||||
this.reportedFinalAction = true;
|
||||
@@ -229,7 +234,7 @@ class Cognigy extends Task {
|
||||
async _onBotFinalPing(cs, ep) {
|
||||
this.logger.info({prompts: this.prompts}, 'Cognigy:_onBotFinalPing');
|
||||
await this.taskQueue.lastPromise;
|
||||
this.gatherTask = this._makeGatherTask({textPrompt: "this should be changed"});
|
||||
this.gatherTask = this._makeGatherTask({textPrompt: 'this should be changed'});
|
||||
this.gatherTask.exec(cs, ep, this)
|
||||
.catch((err) => this.logger.info({err}, 'Cognigy gather task returned error'));
|
||||
this.prompts = [];
|
||||
@@ -256,11 +261,11 @@ class Cognigy extends Task {
|
||||
const text = parseBotText(evt);
|
||||
if (evt.data) this.config.update(evt.data);
|
||||
if (text) {
|
||||
|
||||
|
||||
await this._enqueueTask((async() => {
|
||||
this.logger.info({text}, "received text");
|
||||
const sayTask = this._makeSayTask(text);
|
||||
await sayTask.exec(cs, ep, this);
|
||||
this.logger.info({text}, 'received text');
|
||||
const sayTask = this._makeSayTask(text);
|
||||
await sayTask.exec(cs, ep, this);
|
||||
}).bind(this));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user