Android: include error types in getCurrentPosition error

Summary:
Thank you for sending the PR! We appreciate you spending the time to work on these changes.
Help us understand your motivation by explaining why you decided to make this change.

Include geolocation error types in error, and provide feature parity with iOS.

If error occurs when you call getCurrentPosition, then error object includes PERMISSION_DENIED, POSITION_UNAVAILABLE, TIMEOUT keys with error codes. It should be used to compare with error.code value.

This is minor fix that provides feature parity with iOS.
Closes https://github.com/facebook/react-native/pull/18533

Differential Revision: D7396586

Pulled By: mdvacca

fbshipit-source-id: bd698b80a3d075456738a3d4e48b572ae819ee3d
This commit is contained in:
Dulmandakh 2018-03-25 20:56:27 -07:00 committed by Facebook Github Bot
parent 85e33aaf90
commit 226bff3ed0
1 changed files with 8 additions and 0 deletions

View File

@ -35,9 +35,17 @@ public class PositionError {
public static WritableMap buildError(int code, String message) {
WritableMap error = Arguments.createMap();
error.putInt("code", code);
if (message != null) {
error.putString("message", message);
}
/**
* Provide error types in error message. Feature parity with iOS
*/
error.putInt("PERMISSION_DENIED", PERMISSION_DENIED);
error.putInt("POSITION_UNAVAILABLE", POSITION_UNAVAILABLE);
error.putInt("TIMEOUT", TIMEOUT);
return error;
}
}