Merge pull request #1340 from k9mail/crash_on_migration_error
Crash app when migrations fail in debug build
This commit is contained in:
commit
28232ed108
2 changed files with 9 additions and 5 deletions
|
@ -434,11 +434,10 @@ public class AccountSetupCheckSettings extends K9Activity implements OnClickList
|
||||||
afe.getMessage() == null ? "" : afe.getMessage());
|
afe.getMessage() == null ? "" : afe.getMessage());
|
||||||
} catch (CertificateValidationException cve) {
|
} catch (CertificateValidationException cve) {
|
||||||
handleCertificateValidationException(cve);
|
handleCertificateValidationException(cve);
|
||||||
} catch (Throwable t) {
|
} catch (Exception e) {
|
||||||
Log.e(K9.LOG_TAG, "Error while testing settings", t);
|
Log.e(K9.LOG_TAG, "Error while testing settings", e);
|
||||||
showErrorDialog(
|
String message = e.getMessage() == null ? "" : e.getMessage();
|
||||||
R.string.account_setup_failed_dlg_server_message_fmt,
|
showErrorDialog(R.string.account_setup_failed_dlg_server_message_fmt, message);
|
||||||
(t.getMessage() == null ? "" : t.getMessage()));
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@ import android.database.sqlite.SQLiteDatabase;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import com.fsck.k9.Account;
|
import com.fsck.k9.Account;
|
||||||
|
import com.fsck.k9.BuildConfig;
|
||||||
import com.fsck.k9.K9;
|
import com.fsck.k9.K9;
|
||||||
import com.fsck.k9.mail.Flag;
|
import com.fsck.k9.mail.Flag;
|
||||||
import com.fsck.k9.mailstore.migrations.Migrations;
|
import com.fsck.k9.mailstore.migrations.Migrations;
|
||||||
|
@ -34,6 +35,10 @@ class StoreSchemaDefinition implements LockableDatabase.SchemaDefinition {
|
||||||
try {
|
try {
|
||||||
upgradeDatabase(db);
|
upgradeDatabase(db);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
if (BuildConfig.DEBUG) {
|
||||||
|
throw new Error("Exception while upgrading database", e);
|
||||||
|
}
|
||||||
|
|
||||||
Log.e(K9.LOG_TAG, "Exception while upgrading database. Resetting the DB to v0", e);
|
Log.e(K9.LOG_TAG, "Exception while upgrading database. Resetting the DB to v0", e);
|
||||||
db.setVersion(0);
|
db.setVersion(0);
|
||||||
upgradeDatabase(db);
|
upgradeDatabase(db);
|
||||||
|
|
Loading…
Reference in a new issue