From 94d93f7d41365cbcdddf36b1a9c0bcd8ec2fd325 Mon Sep 17 00:00:00 2001 From: dabit1 Date: Fri, 24 Mar 2017 18:28:34 -0700 Subject: [PATCH] PositionError must be an object, not string Summary: As specifications says, the Position error must be an object with code and message attributes. Right now it is a string. If not, we can't know what kind of error is. Another issue is that the message must be exactly "No available location provider." Specifications: https://developer.mozilla.org/en/docs/Web/API/PositionError Closes https://github.com/facebook/react-native/pull/13140 Differential Revision: D4774922 Pulled By: ericvicenti fbshipit-source-id: f956af051461e9f8d6435496283e54b3c4dc8ef5 --- .../com/facebook/react/modules/location/LocationModule.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ReactAndroid/src/main/java/com/facebook/react/modules/location/LocationModule.java b/ReactAndroid/src/main/java/com/facebook/react/modules/location/LocationModule.java index ea0ed5a5c..866309241 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/modules/location/LocationModule.java +++ b/ReactAndroid/src/main/java/com/facebook/react/modules/location/LocationModule.java @@ -123,7 +123,7 @@ public class LocationModule extends ReactContextBaseJavaModule { (LocationManager) getReactApplicationContext().getSystemService(Context.LOCATION_SERVICE); String provider = getValidProvider(locationManager, locationOptions.highAccuracy); if (provider == null) { - error.invoke("No available location provider."); + emitError(PositionError.PERMISSION_DENIED, "No location provider available."); return; } Location location = locationManager.getLastKnownLocation(provider);