Skip to content

Commit

Permalink
add error logs
Browse files Browse the repository at this point in the history
  • Loading branch information
JohaoRosasRosillo committed Jan 19, 2023
1 parent 33482d8 commit b9e0c3d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
5 changes: 4 additions & 1 deletion lib/agent/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion lib/agent/hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
});

Expand Down
5 changes: 4 additions & 1 deletion lib/agent/triggers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit b9e0c3d

Please sign in to comment.