If bad start detected, shut down the Robot

This commit is contained in:
Andrew Stewart 2015-01-20 19:18:52 -08:00
parent 42ca88f8d0
commit 5354102c2e
1 changed files with 8 additions and 4 deletions

View File

@ -295,11 +295,15 @@ Robot.prototype.start = function(callback) {
Logger.fatal("An error occured while trying to start the robot:"); Logger.fatal("An error occured while trying to start the robot:");
Logger.fatal(err); Logger.fatal(err);
if (typeof(this.error) === "function") { this.halt(function() {
this.error.call(this, err); if (typeof(this.error) === "function") {
} this.error.call(this, err);
}
this.emit("error", err); if (this.listeners("error").length) {
this.emit("error", err);
}
}.bind(this));
} }
if (_.isFunction(callback)) { if (_.isFunction(callback)) {