/**
 * Copyright (c) 2015-present, Facebook, Inc.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */

package com.facebook.react.modules.location;

import com.facebook.react.bridge.Arguments;
import com.facebook.react.bridge.WritableMap;

/**
 * @see {https://developer.mozilla.org/en-US/docs/Web/API/PositionError}
 */
public class PositionError {
  /**
   * The acquisition of the geolocation information failed because
   * the page didn't have the permission to do it.
   */
  public static int PERMISSION_DENIED = 1;

  /**
   * The acquisition of the geolocation failed because at least one
   * internal source of position returned an internal error.
   */
  public static int POSITION_UNAVAILABLE = 2;

  /**
   * The time allowed to acquire the geolocation, defined by
   * PositionOptions.timeout information was reached before the information was obtained.
   */
  public static int TIMEOUT = 3;

  public static WritableMap buildError(int code, String message) {
    WritableMap error = Arguments.createMap();
    error.putInt("code", code);
    if (message != null) {
      error.putString("message", message);
    }
    return error;
  }
}

@@ -1125,24 +1125,25 @@
 de%22, code);%0A
+%0A
     if (mess
@@ -1206,16 +1206,264 @@
 ;%0A    %7D%0A
+    %0A    /**%0A    * Provide error types in error message. Feature parity with iOS%0A    */%0A    error.putInt(%22PERMISSION_DENIED%22, PERMISSION_DENIED);%0A    error.putInt(%22POSITION_UNAVAILABLE%22, POSITION_UNAVAILABLE);%0A    error.putInt(%22TIMEOUT%22, TIMEOUT);%0A
     retu

include error types in getCurrentPosition error