1
0
Fork 0
mirror of https://github.com/syncthing/syncthing-android.git synced 2024-12-23 11:21:29 +00:00

Don't force crash in release mode (fixes #595).

This commit is contained in:
Felix Ableitner 2016-04-10 17:06:24 +02:00
parent c836da275a
commit 6a686cdb95
2 changed files with 10 additions and 4 deletions

@ -1 +1 @@
Subproject commit 6d280e7b6461d407c90f8706e348393c657e995f Subproject commit 668eb7c398c2e8d0b9f7beb319b7789681d7d89f

View file

@ -9,6 +9,8 @@ import android.preference.PreferenceManager;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log; import android.util.Log;
import com.nutomic.syncthingandroid.BuildConfig;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.DataOutputStream; import java.io.DataOutputStream;
import java.io.IOException; import java.io.IOException;
@ -152,9 +154,13 @@ public class SyncthingRunnable implements Runnable {
case 1: case 1:
// fallthrough // fallthrough
default: default:
// Force crash if Syncthing exits with an error. // Report Syncthing crashes, using Exception in debug mode or log in release mode.
throw new RuntimeException("Syncthing binary crashed with error code " + String message = "Syncthing binary crashed with error code " +
Integer.toString(ret) + ", output:\n" + mErrorLog); Integer.toString(ret) + ", output:\n" + mErrorLog;
if (BuildConfig.DEBUG)
throw new RuntimeException(message);
else
Log.e(TAG, message);
} }
} catch (IOException | InterruptedException e) { } catch (IOException | InterruptedException e) {
Log.e(TAG, "Failed to execute syncthing binary or read output", e); Log.e(TAG, "Failed to execute syncthing binary or read output", e);