summaryrefslogtreecommitdiff
path: root/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/http/HTTPRequest.java
diff options
context:
space:
mode:
authorAntonio Zugaldia <antonio@mapbox.com>2016-09-19 18:30:56 -0400
committerBrad Leege <brad@mapbox.com>2016-09-19 17:30:56 -0500
commit79708ff9d8a364ad83d390edb402f03761f0c885 (patch)
tree69e88718097ddb56e4791a487656f5cf7394eaca /platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/http/HTTPRequest.java
parent13e63dbff5eb58966cdf446e545b55577b0f5965 (diff)
downloadqtlocation-mapboxgl-79708ff9d8a364ad83d390edb402f03761f0c885.tar.gz
Adjust logging level for failed OkHttp requests (#6378)
* log level depending on the error type * Squashing and Merging * remove unnecessary log (with wrong tag)
Diffstat (limited to 'platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/http/HTTPRequest.java')
-rw-r--r--platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/http/HTTPRequest.java14
1 files changed, 12 insertions, 2 deletions
diff --git a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/http/HTTPRequest.java b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/http/HTTPRequest.java
index a573f7d870..8c818c2f52 100644
--- a/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/http/HTTPRequest.java
+++ b/platform/android/MapboxGLAndroidSDK/src/main/java/com/mapbox/mapboxsdk/http/HTTPRequest.java
@@ -138,8 +138,6 @@ class HTTPRequest implements Callback {
}
private void onFailure(Exception e) {
- Log.w(LOG_TAG, String.format("[HTTP] Request could not be executed: %s", e.getMessage()));
-
int type = PERMANENT_ERROR;
if ((e instanceof NoRouteToHostException) || (e instanceof UnknownHostException) || (e instanceof SocketException) || (e instanceof ProtocolException) || (e instanceof SSLException)) {
type = CONNECTION_ERROR;
@@ -149,6 +147,18 @@ class HTTPRequest implements Callback {
String errorMessage = e.getMessage() != null ? e.getMessage() : "Error processing the request";
+ if (type == TEMPORARY_ERROR) {
+ Log.d(LOG_TAG, String.format(MapboxConstants.MAPBOX_LOCALE,
+ "Request failed due to a temporary error: %s", errorMessage));
+ } else if (type == CONNECTION_ERROR) {
+ Log.i(LOG_TAG, String.format(MapboxConstants.MAPBOX_LOCALE,
+ "Request failed due to a connection error: %s", errorMessage));
+ } else {
+ // PERMANENT_ERROR
+ Log.w(LOG_TAG, String.format(MapboxConstants.MAPBOX_LOCALE,
+ "Request failed due to a permanent error: %s", errorMessage));
+ }
+
mLock.lock();
if (mNativePtr != 0) {
nativeOnFailure(type, errorMessage);