SealiteException

Sealite refused a database or could not finish a maintenance operation; error says why.

try {
db.noteDao().all()
} catch (e: Exception) {
when (Sealite.errorOf(e)) {
SealiteError.WRONG_KEY -> askForTheKeyAgain()
SealiteError.NOT_ENCRYPTED -> migrate()
else -> throw e
}
}

This is deliberately not an androidx.sqlite.SQLiteException: Room's corruption recovery (allowDataLossOnRecovery) deletes the database only for SQLiteException, so a wrong key can never make Room delete an encrypted database. Plain SQLite failures (I/O, constraints, a damaged page under the right key) are still reported as SQLiteException.

Properties

Link copied to clipboard
expect open val cause: Throwable?
Link copied to clipboard

why Sealite refused.

Link copied to clipboard
expect open val message: String?