Skip to content

Commit

Permalink
Avoid throwing an error if Appium Settings fails to provide geolocati…
Browse files Browse the repository at this point in the history
…on values (#493)
  • Loading branch information
mykola-mokhnach committed Jan 24, 2019
1 parent 12d530e commit dfbb074
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion lib/commands/network.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,17 @@ commands.toggleFlightMode = async function () {

commands.setGeoLocation = async function (location) {
await this.adb.setGeoLocation(location, this.isEmulator());
return await this.getGeoLocation();
try {
return await this.getGeoLocation();
} catch (e) {
log.warn(`Could not get the current geolocation info: ${e.message}`);
log.warn(`Returning the default zero'ed values`);
return {
latitude: 0.0,
longitude: 0.0,
altitude: 0.0,
};
}
};

commands.getGeoLocation = async function () {
Expand Down

0 comments on commit dfbb074

Please sign in to comment.