Actually log spawn() failure in Event Scheduler

This commit is contained in:
Bryan Ashby 2018-11-21 22:21:24 -07:00
parent ec1ce3062e
commit 20e9d9ad7e
1 changed files with 12 additions and 4 deletions

View File

@ -117,7 +117,7 @@ class ScheduledEvent {
methodModule[this.action.what](this.action.args, err => { methodModule[this.action.what](this.action.args, err => {
if(err) { if(err) {
Log.debug( Log.debug(
{ error : err.toString(), eventName : this.name, action : this.action }, { error : err.message, eventName : this.name, action : this.action },
'Error performing scheduled event action'); 'Error performing scheduled event action');
} }
@ -125,7 +125,7 @@ class ScheduledEvent {
}); });
} catch(e) { } catch(e) {
Log.warn( Log.warn(
{ error : e.toString(), eventName : this.name, action : this.action }, { error : e.message, eventName : this.name, action : this.action },
'Failed to perform scheduled event action'); 'Failed to perform scheduled event action');
return cb(e); return cb(e);
@ -143,9 +143,17 @@ class ScheduledEvent {
try { try {
proc = pty.spawn(this.action.what, this.action.args, opts); proc = pty.spawn(this.action.what, this.action.args, opts);
} catch(e) { } catch(e) {
return cb(Errors.ExternalProcess( Log.warn(
`Error spawning @execute process "${this.action.what}" with args "${this.action.args.join(' ')}": ${e.message}`) {
error : 'Failed to spawn @execute process',
reason : e.message,
eventName : this.name,
action : this.action,
what : this.action.what,
args : this.action.args
}
); );
return cb(e);
} }
proc.once('exit', exitCode => { proc.once('exit', exitCode => {