Skip to content

Commit

Permalink
improved error handling
Browse files Browse the repository at this point in the history
in fixing the one I missed, I noticed that it's procedure in this codebase to emit asynchronously.
  • Loading branch information
shenanigans authored and indexzero committed Oct 30, 2014
1 parent 6707a40 commit eecf6a2
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions lib/forever.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,13 @@ function stopOrRestart(action, event, format, target) {
});
}

getAllProcesses(function (processes) {
getAllProcesses(function (err, processes) {
if (err) {
return process.nextTick(function () {
emitter.emit('error', err);
});
}

var procs = processes;

if (target !== undefined && target !== null) {
Expand Down Expand Up @@ -732,8 +738,9 @@ forever.cleanUp = function (cleanLogs, allowManager) {

getAllProcesses(function (err, processes) {
if (err) {
emitter.emit('error', err);
return;
return process.nextTick(function () {
emitter.emit('error', err);
});
}
else if (cleanLogs) {
forever.cleanLogsSync(processes);
Expand Down

0 comments on commit eecf6a2

Please sign in to comment.