@capgo/nativegeocoder 1.0.12 → 1.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -99,9 +99,29 @@ struct NativeGeocoderOptions: Decodable {
99
99
  options.maxResults = call.getInt("maxResults") ?? 1
100
100
 
101
101
  forwardGeocodeHandler(address, options: options, completionHandler: { (resultObj, error) in
102
- if let error = error {
103
- call.reject(error.message)
104
- } else {
102
+ if let error = error as? CLError {
103
+ var msg = "CLGeocoder:forwardGeocodeLocation Error"
104
+ switch error.code {
105
+ case .locationUnknown:
106
+ msg = "locationUnknown: location manager was unable to obtain a location value right now."
107
+ case .denied:
108
+ msg = "denied: user denied access to the location service."
109
+ case .promptDeclined:
110
+ msg = "promptDeclined: user didn’t grant the requested temporary authorization."
111
+ case .network:
112
+ msg = "network: network was unavailable or a network error occurred."
113
+ case .headingFailure:
114
+ msg = "headingFailure: heading could not be determined."
115
+ case .rangingUnavailable:
116
+ msg = "rangingUnavailable: ranging is disabled."
117
+ case .rangingFailure:
118
+ msg = "rangingFailure: a general ranging error occurred."
119
+ default : break
120
+ }
121
+ print(msg)
122
+ call.reject(msg)
123
+ }
124
+ else {
105
125
  call.resolve(["addresses": resultObj])
106
126
  }
107
127
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/nativegeocoder",
3
- "version": "1.0.12",
3
+ "version": "1.0.13",
4
4
  "description": "Capacitor plugin for native forward and reverse geocoding",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",