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