aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2021-10-04 10:00:40 -0700
committerGitHub <noreply@github.com>2021-10-04 10:00:40 -0700
commitb8081917a2df902d1aa50b3f047dc8c6b5fe8836 (patch)
tree91af347956ed628118f9d1ba3605ad1f68cbc120
parent55803843eb2f9ea90b5fd712d2549305062d7a2c (diff)
parent5118f5e281de16f5b17d147da462b6cfb16e4d4d (diff)
downloadtrackermap-server-b8081917a2df902d1aa50b3f047dc8c6b5fe8836.tar.gz
trackermap-server-b8081917a2df902d1aa50b3f047dc8c6b5fe8836.tar.bz2
trackermap-server-b8081917a2df902d1aa50b3f047dc8c6b5fe8836.zip
Merge pull request #4751 from soshial/patch-1
Improve OpenCellId error logging
-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"));
+ }
}
}