Error Handling
This commit is contained in:
parent
8f6f3dc72d
commit
9a5c3f942c
12
index.js
12
index.js
@ -141,6 +141,7 @@ NeatoVacuumRobot.prototype = {
|
|||||||
callback();
|
callback();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
debug(that.robot);
|
||||||
callback();
|
callback();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -186,7 +187,6 @@ NeatoVacuumRobot.prototype = {
|
|||||||
let that = this;
|
let that = this;
|
||||||
this.getStateAndRobot(function (error, result) {
|
this.getStateAndRobot(function (error, result) {
|
||||||
debug("Is docked: " + that.robot.isDocked);
|
debug("Is docked: " + that.robot.isDocked);
|
||||||
debug(that.robot);
|
|
||||||
callback(false, that.robot.isDocked);
|
callback(false, that.robot.isDocked);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -295,18 +295,28 @@ NeatoVacuumRobot.prototype = {
|
|||||||
client.authorize(this.email, this.password, false, function (error) {
|
client.authorize(this.email, this.password, false, function (error) {
|
||||||
if (error) {
|
if (error) {
|
||||||
that.log(error);
|
that.log(error);
|
||||||
|
that.log.error("Can't log on to neato cloud. Please check your credentials.")
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
client.getRobots(function (error, robots) {
|
client.getRobots(function (error, robots) {
|
||||||
if (error) {
|
if (error) {
|
||||||
that.log(error);
|
that.log(error);
|
||||||
|
that.log.error("Successful login but can't connect to your neato robot.")
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (robots.length === 0) {
|
||||||
|
that.log.error("Successful login but no robots associated with your account.")
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
that.robot = robots[0];
|
that.robot = robots[0];
|
||||||
that.log("Found robot: " + that.robot.name);
|
that.log("Found robot: " + that.robot.name);
|
||||||
debug(that.robot);
|
debug(that.robot);
|
||||||
|
if (robots.length > 1){
|
||||||
|
that.log.warn("Found more then one robot in your account. This plugin currently just supports one. First one found will be used.")
|
||||||
|
}
|
||||||
callback();
|
callback();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user