I'm trying to make my SQLite Database interactions in my Android code more robust.
On of my tables has one column that is marked as UNIQUE. Now I want to handle the case that my application tries to enter a non-unique entry. To achieve that I use the method SQLiteDatabase.insertOrThrow(). That method throws an android.database.sqlite.SQLiteException. Unfortunately that exception doesn't allow me to get the error code (like java.sql.SQLException kindly does).
So in my catch-block I have no way of handling the exception error-code-sensitive, am I correct?
What is best practice to handle SQLiteExceptions on Android? Can my application really just say there's a problem but not find out what the problem is?
Thank you for your help and time. Dan
throw. See e.ginsertWithOnConflict(). There's no single "best practice", it depends on your particular case. Could you clarify your question to be more specific? Thanks.