From b9e0c3df6191258ebf2a7ed1031b09d4c72b1bda Mon Sep 17 00:00:00 2001 From: johaoRosasRosillo Date: Thu, 19 Jan 2023 11:04:40 -0300 Subject: [PATCH] add error logs --- lib/agent/actions.js | 5 ++++- lib/agent/hooks.js | 2 +- lib/agent/triggers.js | 5 ++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/agent/actions.js b/lib/agent/actions.js index 586ac289a..31d51503f 100644 --- a/lib/agent/actions.js +++ b/lib/agent/actions.js @@ -22,7 +22,10 @@ var action_running = function(type, id, action, name, opts, emitter) { running[id] = {name: name, action: action}; emitter.once('end', function(id, err, out) { - if (err) hooks.trigger('error', err); + if (err) { + hooks.trigger('error', err); + logger.info('Error: ' + JSON.stringify(err)); + } logger.info(`Stopped: ${name}`); action_stopped(id); diff --git a/lib/agent/hooks.js b/lib/agent/hooks.js index a52353ac2..4213f43fb 100644 --- a/lib/agent/hooks.js +++ b/lib/agent/hooks.js @@ -18,7 +18,7 @@ var unload = function () { }; emitter.on('error', function (err) { - logger.error('error on emitter error'); + logger.error('error on emitter' + ((err) ? JSON.stringify(err) : '')); // prevents 'Unspecified Error event' }); diff --git a/lib/agent/triggers.js b/lib/agent/triggers.js index bcabc67f7..6b75eb0fe 100644 --- a/lib/agent/triggers.js +++ b/lib/agent/triggers.js @@ -72,7 +72,10 @@ var trigger_running = function (type, trigger, name, opts, emitter) { running[name] = trigger; emitter.once('end', function (err, out) { - if (err) hooks.trigger('error', err); + if (err) { + hooks.trigger('error', err); + logger.info('Error: ' + JSON.stringify(err)); + } logger.info(`Stopped: ${name}`); trigger_stopped(name);