diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2019-01-08 10:11:37 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-08 10:11:37 -0800 |
commit | 1d10aeb4671943f851026cb248e7ef24a022174c (patch) | |
tree | 8280cc24940bfd4ef3b0f12d9ca464d6a1e31735 /src/org/traccar/geocoder | |
parent | 90a88ff7584c9d4200f2a32800bf6eaf417955ac (diff) | |
parent | 2bf57a222e2c173df13e4816efb62dfe0f371bfa (diff) | |
download | traccar-server-1d10aeb4671943f851026cb248e7ef24a022174c.tar.gz traccar-server-1d10aeb4671943f851026cb248e7ef24a022174c.tar.bz2 traccar-server-1d10aeb4671943f851026cb248e7ef24a022174c.zip |
Merge pull request #4181 from flocsy/log-battery
Small improvements to logging
Diffstat (limited to 'src/org/traccar/geocoder')
-rw-r--r-- | src/org/traccar/geocoder/GoogleGeocoder.java | 5 | ||||
-rw-r--r-- | src/org/traccar/geocoder/JsonGeocoder.java | 9 |
2 files changed, 12 insertions, 2 deletions
diff --git a/src/org/traccar/geocoder/GoogleGeocoder.java b/src/org/traccar/geocoder/GoogleGeocoder.java index af9b58a90..9494cab45 100644 --- a/src/org/traccar/geocoder/GoogleGeocoder.java +++ b/src/org/traccar/geocoder/GoogleGeocoder.java @@ -90,4 +90,9 @@ public class GoogleGeocoder extends JsonGeocoder { return null; } + @Override + protected String parseError(JsonObject json) { + return json.getString("error_message"); + } + } diff --git a/src/org/traccar/geocoder/JsonGeocoder.java b/src/org/traccar/geocoder/JsonGeocoder.java index 80123e01e..ed59a1d8d 100644 --- a/src/org/traccar/geocoder/JsonGeocoder.java +++ b/src/org/traccar/geocoder/JsonGeocoder.java @@ -64,10 +64,11 @@ public abstract class JsonGeocoder implements Geocoder { } return formattedAddress; } else { + String msg = "Empty address. Error: " + parseError(json); if (callback != null) { - callback.onFailure(new GeocoderException("Empty address")); + callback.onFailure(new GeocoderException(msg)); } else { - LOGGER.warn("Empty address"); + LOGGER.warn(msg); } } return null; @@ -113,4 +114,8 @@ public abstract class JsonGeocoder implements Geocoder { public abstract Address parseAddress(JsonObject json); + protected String parseError(JsonObject json) { + return null; + } + } |