diff --git a/lib/commands/location.js b/lib/commands/location.js index 4f7e7b477..abebc79e5 100644 --- a/lib/commands/location.js +++ b/lib/commands/location.js @@ -31,10 +31,12 @@ export default { // '3' is 'Always' in the privacy // https://developer.apple.com/documentation/corelocation/clauthorizationstatus if (authorizationStatus !== AuthorizationStatus.authorizedAlways) { - this.log.errorAndThrow( + throw this.log.errorWithException( `Location service must be set to 'Always' in order to ` + - `retrive the current geolocation data. Please set it up manually via ` + - `'Settings > Privacy > Location Services -> WebDriverAgentRunner-Runner'`, + `retrieve the current geolocation data. Please set it up manually via ` + + `'Settings > Privacy > Location Services -> WebDriverAgentRunner-Runner'. ` + + `Or please use 'mobile:getSimulatedLocation'/'mobile:setSimulatedLocation' commands ` + + `to simulate locations instead.`, ); } @@ -71,10 +73,9 @@ export default { try { service.setLocation(latitude, longitude); } catch (e) { - this.log.errorAndThrow( + throw this.log.errorWithException( `Can't set the location on device '${this.opts.udid}'. Original error: ${e.message}`, ); - throw new Error(); // unreachable } finally { service.close(); } @@ -98,7 +99,7 @@ export default { try { service.resetLocation(); } catch (err) { - this.log.errorAndThrow( + throw this.log.errorWithException( `Failed to reset the location on the device on device '${this.opts.udid}'. ` + `Origianl error: ${err.message}`, );