SQLiteException not being caught

后端 未结 4 1824
自闭症患者
自闭症患者 2021-01-19 22:56

I\'m trying to catch an \"android.database.sqlite.SQLiteException: error code 5: database is locked\" exception with:

    try {
        db.insert(\"mytable\"         


        
4条回答
  •  独厮守ぢ
    2021-01-19 23:47

    I don't believe that .insert will throw an exception. You're probably just seeing a log message that's being written by it when it catches the exception internally. If you want it to throw an exception when an insert fails, use .insertOrThrow instead.

提交回复
热议问题