Skip to content

Commit

Permalink
Allow failing by throwing an SQLiteException.
Browse files Browse the repository at this point in the history
Signed-off-by: Kenneth J. Shackleton <[email protected]>
  • Loading branch information
kennethshackleton committed Sep 9, 2023
1 parent 5778152 commit fbac4d6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ import com.bloomberg.selekt.SQL_MISUSE
import com.bloomberg.selekt.SQL_NOMEM
import com.bloomberg.selekt.SQL_NOT_A_DATABASE
import com.bloomberg.selekt.SQL_NOT_FOUND
import com.bloomberg.selekt.SQL_OK
import com.bloomberg.selekt.SQL_RANGE
import com.bloomberg.selekt.SQL_READONLY
import com.bloomberg.selekt.SQL_TOO_BIG
Expand Down Expand Up @@ -91,7 +90,6 @@ internal object SQLite : com.bloomberg.selekt.SQLite(sqlite) {
message: String,
context: String?
): Nothing {
require(code != SQL_OK) { "Result code is not an error: $code" }
val exceptionMessage = extendedErrorMessage(code, extendedCode, message, context)
throw when (code) {
SQL_BUSY -> SQLiteDatabaseLockedException(exceptionMessage)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

package com.bloomberg.selekt.android

import android.database.SQLException
import android.database.sqlite.SQLiteAbortException
import android.database.sqlite.SQLiteBindOrColumnIndexOutOfRangeException
import android.database.sqlite.SQLiteBlobTooBigException
Expand Down Expand Up @@ -144,7 +143,7 @@ internal class SQLiteTest {

@Test
fun openThenRekeyWithoutKeyFails() {
assertFailsWith<SQLException> {
assertFailsWith<SQLiteException> {
SQLite.rekey(db, otherKey)
}
}
Expand Down Expand Up @@ -738,7 +737,7 @@ internal class SQLiteTest {

@Test
fun exceptionForErrorOk() {
assertFailsWith<IllegalArgumentException> {
assertFailsWith<SQLiteException> {
SQLite.throwSQLException(SQL_OK, SQL_OK, "")
}
}
Expand Down

0 comments on commit fbac4d6

Please sign in to comment.