Merge pull request #107 from pnagurny/bug/daemon-error
Fix uncaught exception handling
This commit is contained in:
commit
4dad90138b
|
@ -144,10 +144,10 @@ Daemon.prototype.start = function(options, callback) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
errorCaught = err;
|
errorCaught = err;
|
||||||
self.error('Uncaught error: shutting down safely before throwing...');
|
log.error('Uncaught error: shutting down safely before throwing...');
|
||||||
if (!self._shutdown) {
|
if (!self._shutdown) {
|
||||||
if (err && err.stack) {
|
if (err && err.stack) {
|
||||||
console.error(err.stack);
|
log.error(err.stack);
|
||||||
}
|
}
|
||||||
self._exit(1);
|
self._exit(1);
|
||||||
return;
|
return;
|
||||||
|
@ -219,11 +219,16 @@ Daemon.prototype.start = function(options, callback) {
|
||||||
process.kill(process.pid, exitCaught.name);
|
process.kill(process.pid, exitCaught.name);
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
} else if (errorCaught && errorCaught.stack) {
|
|
||||||
console.error(errorCaught.stack);
|
|
||||||
}
|
}
|
||||||
return self._exit(exitCaught);
|
return self._exit(exitCaught);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (errorCaught !== none) {
|
||||||
|
if (errorCaught && errorCaught.stack) {
|
||||||
|
log.error(errorCaught.stack);
|
||||||
|
}
|
||||||
|
return self._exit(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}, 1000);
|
}, 1000);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue