diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2021-10-04 10:00:40 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-04 10:00:40 -0700 |
commit | b8081917a2df902d1aa50b3f047dc8c6b5fe8836 (patch) | |
tree | 91af347956ed628118f9d1ba3605ad1f68cbc120 /src/main/java/org | |
parent | 55803843eb2f9ea90b5fd712d2549305062d7a2c (diff) | |
parent | 5118f5e281de16f5b17d147da462b6cfb16e4d4d (diff) | |
download | traccar-server-b8081917a2df902d1aa50b3f047dc8c6b5fe8836.tar.gz traccar-server-b8081917a2df902d1aa50b3f047dc8c6b5fe8836.tar.bz2 traccar-server-b8081917a2df902d1aa50b3f047dc8c6b5fe8836.zip |
Merge pull request #4751 from soshial/patch-1
Improve OpenCellId error logging
Diffstat (limited to 'src/main/java/org')
-rw-r--r-- | src/main/java/org/traccar/geolocation/OpenCellIdGeolocationProvider.java | 10 |
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")); + } } } |