|
|
@@ -13,6 +13,8 @@ import io.reactivex.schedulers.Schedulers;
|
|
|
import kr.co.zumo.app.lifeplus.bean.api.LifeplusAPIBean;
|
|
|
import kr.co.zumo.app.lifeplus.bean.api.RequestBean;
|
|
|
import kr.co.zumo.app.lifeplus.network.api.ParameterMapper;
|
|
|
+import kr.co.zumo.app.lifeplus.util.AppUtil;
|
|
|
+import kr.co.zumo.app.lifeplus.util.StringUtil;
|
|
|
|
|
|
/**
|
|
|
* APIFAQModule
|
|
|
@@ -51,22 +53,24 @@ public abstract class APIModule<T extends RequestBean, R extends LifeplusAPIBean
|
|
|
|
|
|
private void trace(String str) {
|
|
|
|
|
|
- int limit = 3000;
|
|
|
- if (str.length() > limit) {
|
|
|
- Log.d("APP# APIModule | trace", "| " + APIModule.this.getClass().getSimpleName() + " <- length = " + str.length());
|
|
|
- int chunkCount = str.length() / limit; // integer division
|
|
|
- for (int i = 0; i <= chunkCount; i++) {
|
|
|
- int max = limit * (i + 1);
|
|
|
- if (max >= str.length()) {
|
|
|
- Log.d("APP# APIModule | trace", "| <- " + str.substring(limit * i));
|
|
|
- }
|
|
|
- else {
|
|
|
- Log.d("APP# APIModule | trace", "| <- " + str.substring(limit * i, max));
|
|
|
+ if (AppUtil.isDebug()) {
|
|
|
+ int limit = 3000;
|
|
|
+ if (str.length() > limit) {
|
|
|
+ Log.d("APP# APIModule | trace", "| " + APIModule.this.getClass().getSimpleName() + " <- length = " + str.length());
|
|
|
+ int chunkCount = str.length() / limit; // integer division
|
|
|
+ for (int i = 0; i <= chunkCount; i++) {
|
|
|
+ int max = limit * (i + 1);
|
|
|
+ if (max >= str.length()) {
|
|
|
+ Log.d("APP# APIModule | trace", "| <- " + str.substring(limit * i));
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ Log.d("APP# APIModule | trace", "| <- " + str.substring(limit * i, max));
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
- else {
|
|
|
- Log.d("APP# APIModule | accept", "| " + APIModule.this.getClass().getSimpleName() + " <- " + str);
|
|
|
+ else {
|
|
|
+ Log.d("APP# APIModule | accept", "| " + APIModule.this.getClass().getSimpleName() + " <- " + str);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// http://stackoverflow.com/questions/8888654/android-set-max-length-of-logcat-messages
|
|
|
@@ -82,8 +86,16 @@ public abstract class APIModule<T extends RequestBean, R extends LifeplusAPIBean
|
|
|
|
|
|
@Override
|
|
|
public void accept(Throwable e) throws Exception {
|
|
|
+ Log.e("APP# APIErrorConsumer | accept", "| ############################## " + e.toString());
|
|
|
e.printStackTrace();
|
|
|
- listener.onApiError(e.getLocalizedMessage());
|
|
|
+ String message = e.getLocalizedMessage();
|
|
|
+ if (StringUtil.isEmpty(message)) {
|
|
|
+ message = e.getMessage();
|
|
|
+ }
|
|
|
+ if (StringUtil.isEmpty(message)) {
|
|
|
+ message = e.toString();
|
|
|
+ }
|
|
|
+ listener.onApiError(message);
|
|
|
}
|
|
|
}
|
|
|
|