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());
|
||||
} catch (CertificateValidationException cve) {
|
||||
handleCertificateValidationException(cve);
|
||||
} catch (Throwable t) {
|
||||
Log.e(K9.LOG_TAG, "Error while testing settings", t);
|
||||
showErrorDialog(
|
||||
R.string.account_setup_failed_dlg_server_message_fmt,
|
||||
(t.getMessage() == null ? "" : t.getMessage()));
|
||||
} catch (Exception e) {
|
||||
Log.e(K9.LOG_TAG, "Error while testing settings", e);
|
||||
String message = e.getMessage() == null ? "" : e.getMessage();
|
||||
showErrorDialog(R.string.account_setup_failed_dlg_server_message_fmt, message);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ import android.database.sqlite.SQLiteDatabase;
|
|||
import android.util.Log;
|
||||
|
||||
import com.fsck.k9.Account;
|
||||
import com.fsck.k9.BuildConfig;
|
||||
import com.fsck.k9.K9;
|
||||
import com.fsck.k9.mail.Flag;
|
||||
import com.fsck.k9.mailstore.migrations.Migrations;
|
||||
|
@ -34,6 +35,10 @@ class StoreSchemaDefinition implements LockableDatabase.SchemaDefinition {
|
|||
try {
|
||||
upgradeDatabase(db);
|
||||
} 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);
|
||||
db.setVersion(0);
|
||||
upgradeDatabase(db);
|
||||
|
|
Loading…
Reference in a new issue