Add error handler for devices that fail to initialize.
Do not start work if devices fail to initialize and throw err insted.
This commit is contained in:
parent
6d36709207
commit
de360ba2b3
14
lib/robot.js
14
lib/robot.js
|
@ -188,11 +188,15 @@ namespace("Cylon", function() {
|
|||
Robot.prototype.start = function() {
|
||||
var self = this;
|
||||
return this.startConnections(function() {
|
||||
return self.robot.startDevices(function() {
|
||||
self.robot.work.call(self.robot, self.robot);
|
||||
self.running = true;
|
||||
Logger.info("Working...");
|
||||
return self.robot.emit('working');
|
||||
return self.robot.startDevices(function(err) {
|
||||
if (err) {
|
||||
throw err;
|
||||
}else{
|
||||
self.robot.work.call(self.robot, self.robot);
|
||||
self.running = true;
|
||||
Logger.info("Working...");
|
||||
self.robot.emit('working');
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue