Unverified Commit 61707e2d authored by Leonardo Aramaki's avatar Leonardo Aramaki Committed by GitHub

Merge pull request #584 from RocketChat/fix/crash

Fix connect timeout crash
parents 2066f29c c26cb152
...@@ -20,8 +20,8 @@ android { ...@@ -20,8 +20,8 @@ android {
applicationId "chat.rocket.android" applicationId "chat.rocket.android"
minSdkVersion 16 minSdkVersion 16
targetSdkVersion rootProject.ext.targetSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 53 versionCode 54
versionName "1.0.30" versionName "1.0.31"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true vectorDrawables.useSupportLibrary = true
multiDexEnabled true multiDexEnabled true
......
...@@ -7,8 +7,8 @@ import android.support.v7.app.AppCompatDelegate; ...@@ -7,8 +7,8 @@ import android.support.v7.app.AppCompatDelegate;
import com.crashlytics.android.Crashlytics; import com.crashlytics.android.Crashlytics;
import java.util.List; 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.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;
...@@ -54,13 +54,10 @@ public class RocketChatApplication extends MultiDexApplication { ...@@ -54,13 +54,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