aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/org/traccar/geocoder/GoogleGeocoder.java5
-rw-r--r--src/org/traccar/geocoder/JsonGeocoder.java9
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..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 "";
+ }
+
}