Commit b134afdb authored by Leonardo Aramaki's avatar Leonardo Aramaki
parent 48580aae
...@@ -77,6 +77,10 @@ public class DDPClientImpl { ...@@ -77,6 +77,10 @@ public class DDPClientImpl {
callback -> callback instanceof RxWebSocketCallback.Message) callback -> callback instanceof RxWebSocketCallback.Message)
.map(callback -> ((RxWebSocketCallback.Message) callback).responseBodyString) .map(callback -> ((RxWebSocketCallback.Message) callback).responseBodyString)
.map(DDPClientImpl::toJson) .map(DDPClientImpl::toJson)
.map(jsonObject -> {
if (true) throw new IllegalAccessException();
return jsonObject;
})
.timeout(7, TimeUnit.SECONDS) .timeout(7, TimeUnit.SECONDS)
.subscribe(response -> { .subscribe(response -> {
String msg = extractMsg(response); String msg = extractMsg(response);
......
...@@ -6,13 +6,16 @@ import android.support.v7.app.AppCompatDelegate; ...@@ -6,13 +6,16 @@ import android.support.v7.app.AppCompatDelegate;
import com.crashlytics.android.Crashlytics; import com.crashlytics.android.Crashlytics;
import java.util.IllegalFormatCodePointException;
import java.util.List; import java.util.List;
import java.util.concurrent.TimeoutException; import java.util.concurrent.TimeoutException;
import chat.rocket.android.helper.Logger;
import chat.rocket.android.helper.OkHttpHelper; import chat.rocket.android.helper.OkHttpHelper;
import chat.rocket.android.service.ConnectivityManager; import chat.rocket.android.service.ConnectivityManager;
import chat.rocket.android.widget.RocketChatWidgets; import chat.rocket.android.widget.RocketChatWidgets;
import chat.rocket.android_ddp.DDPClient; import chat.rocket.android_ddp.DDPClient;
import chat.rocket.android_ddp.DDPClientCallback;
import chat.rocket.core.models.ServerInfo; import chat.rocket.core.models.ServerInfo;
import chat.rocket.persistence.realm.RealmStore; import chat.rocket.persistence.realm.RealmStore;
import chat.rocket.persistence.realm.RocketChatPersistenceRealm; import chat.rocket.persistence.realm.RocketChatPersistenceRealm;
...@@ -54,13 +57,10 @@ public class RocketChatApplication extends MultiDexApplication { ...@@ -54,13 +57,10 @@ public class RocketChatApplication extends MultiDexApplication {
if (e instanceof UndeliverableException) { if (e instanceof UndeliverableException) {
e = e.getCause(); e = e.getCause();
} }
if (e instanceof TimeoutException) { if (BuildConfig.DEBUG) {
// Some work timed-out after a server change is most probable. e.printStackTrace();
return;
} }
Logger.report(e);
Thread.currentThread().getUncaughtExceptionHandler()
.uncaughtException(Thread.currentThread(), e);
}); });
instance = this; instance = this;
......
...@@ -114,6 +114,8 @@ public class MethodCallHelper { ...@@ -114,6 +114,8 @@ public class MethodCallHelper {
return Task.forError(new Exception(errMessage)); return Task.forError(new Exception(errMessage));
} else if (exception instanceof DDPClientCallback.RPC.Timeout) { } else if (exception instanceof DDPClientCallback.RPC.Timeout) {
return Task.forError(new MethodCall.Timeout()); return Task.forError(new MethodCall.Timeout());
} else if (exception instanceof DDPClientCallback.Closed) {
return Task.forError(new Exception("Oops, your connection seems off..."));
} else { } else {
return Task.forError(exception); return Task.forError(exception);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment