From 3897d9418dcffe0db9b326661c7f8ef6a2da49ec Mon Sep 17 00:00:00 2001 From: Gavriel Fleischer Date: Mon, 7 Jan 2019 22:04:01 +0200 Subject: log error in geocoder --- src/org/traccar/geocoder/JsonGeocoder.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/org/traccar/geocoder') diff --git a/src/org/traccar/geocoder/JsonGeocoder.java b/src/org/traccar/geocoder/JsonGeocoder.java index 80123e01e..9157297bf 100644 --- a/src/org/traccar/geocoder/JsonGeocoder.java +++ b/src/org/traccar/geocoder/JsonGeocoder.java @@ -65,7 +65,7 @@ public abstract class JsonGeocoder implements Geocoder { return formattedAddress; } else { if (callback != null) { - callback.onFailure(new GeocoderException("Empty address")); + callback.onFailure(new GeocoderException("Empty address. " + json.getString("error_message"))); } else { LOGGER.warn("Empty address"); } -- cgit v1.2.3 From cca181a4a70ca729c981bb9c62242042698c7476 Mon Sep 17 00:00:00 2001 From: Gavriel Fleischer Date: Tue, 8 Jan 2019 01:26:29 +0200 Subject: log error in GoogleGeocoder --- src/org/traccar/geocoder/GoogleGeocoder.java | 5 +++++ src/org/traccar/geocoder/JsonGeocoder.java | 9 +++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) (limited to 'src/org/traccar/geocoder') diff --git a/src/org/traccar/geocoder/GoogleGeocoder.java b/src/org/traccar/geocoder/GoogleGeocoder.java index af9b58a90..23a08b6e2 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 getError(JsonObject json) { + return json.getString("error_message"); + } + } diff --git a/src/org/traccar/geocoder/JsonGeocoder.java b/src/org/traccar/geocoder/JsonGeocoder.java index 9157297bf..3a0175dae 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. " + getError(json); if (callback != null) { - callback.onFailure(new GeocoderException("Empty address. " + json.getString("error_message"))); + 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 getError(JsonObject json) { + return ""; + } + } -- cgit v1.2.3 From 48f3c2ef839fae5d7046da61c8ec683d0a3d2dfb Mon Sep 17 00:00:00 2001 From: Gavriel Fleischer Date: Tue, 8 Jan 2019 10:55:26 +0200 Subject: renamed method to parseError --- src/org/traccar/geocoder/GoogleGeocoder.java | 2 +- src/org/traccar/geocoder/JsonGeocoder.java | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src/org/traccar/geocoder') diff --git a/src/org/traccar/geocoder/GoogleGeocoder.java b/src/org/traccar/geocoder/GoogleGeocoder.java index 23a08b6e2..9494cab45 100644 --- a/src/org/traccar/geocoder/GoogleGeocoder.java +++ b/src/org/traccar/geocoder/GoogleGeocoder.java @@ -91,7 +91,7 @@ public class GoogleGeocoder extends JsonGeocoder { } @Override - protected String getError(JsonObject json) { + 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 3a0175dae..ed59a1d8d 100644 --- a/src/org/traccar/geocoder/JsonGeocoder.java +++ b/src/org/traccar/geocoder/JsonGeocoder.java @@ -64,7 +64,7 @@ public abstract class JsonGeocoder implements Geocoder { } return formattedAddress; } else { - String msg = "Empty address. " + getError(json); + String msg = "Empty address. Error: " + parseError(json); if (callback != null) { callback.onFailure(new GeocoderException(msg)); } else { @@ -114,8 +114,8 @@ public abstract class JsonGeocoder implements Geocoder { public abstract Address parseAddress(JsonObject json); - protected String getError(JsonObject json) { - return ""; + protected String parseError(JsonObject json) { + return null; } } -- cgit v1.2.3