Add more extensive error logging

This commit is contained in:
Mieszko Wrzeszczyński 2018-11-01 21:01:26 +01:00
parent 340e41bc01
commit eff4802c9d

View File

@ -3,6 +3,7 @@ package com.uam.wmi.findmytutor.activity;
import android.animation.ObjectAnimator;
import android.animation.TypeEvaluator;
import android.animation.ValueAnimator;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
@ -12,6 +13,7 @@ import android.support.design.widget.FloatingActionButton;
import android.util.Log;
import com.jakewharton.retrofit2.adapter.rxjava2.HttpException;
import com.mapbox.mapboxsdk.style.layers.CircleLayer;
import com.mapbox.mapboxsdk.style.layers.Layer;
import com.mapbox.mapboxsdk.style.layers.SymbolLayer;
@ -41,6 +43,7 @@ import com.uam.wmi.findmytutor.model.Coordinate;
import com.uam.wmi.findmytutor.network.RetrofitClientInstance;
import com.uam.wmi.findmytutor.service.CoordinateService;
import com.uam.wmi.findmytutor.utils.PrefUtils;
import com.uam.wmi.findmytutor.utils.RestApiHelper;
import com.uam.wmi.findmytutor.utils.mapUtils;
import java.nio.ByteBuffer;
@ -53,6 +56,7 @@ import io.reactivex.annotations.NonNull;
import io.reactivex.disposables.CompositeDisposable;
import io.reactivex.observers.DisposableSingleObserver;
import io.reactivex.schedulers.Schedulers;
import okhttp3.ResponseBody;
public class MapActivity extends BaseActivity
@ -233,10 +237,17 @@ public class MapActivity extends BaseActivity
}
}
}
@SuppressLint("LongLogTag")
@Override
public void onError(Throwable e) {
Log.e("Error", e.toString());
Log.e("MapActivity onError", e.getMessage());
if (e instanceof HttpException) {
ResponseBody responseBody = ((HttpException) e).response().errorBody();
Log.e("MapActivity onError", RestApiHelper.getErrorMessage(responseBody));
}
}
})
);