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
This commit is contained in:
dabit1 2017-03-24 18:28:34 -07:00 committed by Facebook Github Bot
parent 27c3e32abf
commit 94d93f7d41

View File

@ -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);