Custom error handler when using sqlcipher with sqldelight (Android)

I’d like to change the default behavior when the database becomes corrupt. This is because, if the corruption is in FTS5 tables, then often those can just be recovered with an FTS5 rebuild, thus preserving the rest of the database.

However, I’m struggling to find a way to override the default error handler when using sqldelight. I’ve tried overriding the callback when setting up the driver, but that didn’t seem to do anything.

AndroidSqliteDriver(
    schema,
    context,
    name = dbFilenameOrPath,
    factory = openHelperFactory,
    callback = object : AndroidSqliteDriver.Callback(schema) {
    	....

        override fun onCorruption(db: SupportSQLiteDatabase) {
            // super.onCorruption(db)
            println("when there is a corruption, this is never printed. Instead the database is deleted as per the default behavior")
        }
    },
)

Is there another way?

Please ,may you share with me an sample project that shows the implementation of SQLCipher encryption to SQLDelight database in Kotlin android