aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/org/traccar/geolocation/OpenCellIdGeolocationProvider.java10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/main/java/org/traccar/geolocation/OpenCellIdGeolocationProvider.java b/src/main/java/org/traccar/geolocation/OpenCellIdGeolocationProvider.java
index cb3094e16..2535970d3 100644
--- a/src/main/java/org/traccar/geolocation/OpenCellIdGeolocationProvider.java
+++ b/src/main/java/org/traccar/geolocation/OpenCellIdGeolocationProvider.java
@@ -49,7 +49,15 @@ public class OpenCellIdGeolocationProvider implements GeolocationProvider {
json.getJsonNumber("lat").doubleValue(),
json.getJsonNumber("lon").doubleValue(), 0);
} else {
- callback.onFailure(new GeolocationException("Coordinates are missing"));
+ if (json.containsKey("error")) {
+ String errorMessage = json.getString("error");
+ if (json.containsKey("code")) {
+ errorMessage += " (" + json.getInt("code") + ")";
+ }
+ callback.onFailure(new GeolocationException(errorMessage));
+ } else {
+ callback.onFailure(new GeolocationException("Coordinates are missing"));
+ }
}
}