I'm trying to make an article about catching SQL exceptions in Android. I want just make a list of all possible types of exceptions with description when they can occur.
I of course have visited sites like Android SQLException but there is very little information... just names of exceptions.
For an example (This example is quite obvious but I want them all in one article): android.database.sqlite.SQLiteException: no such column: test (code 1) - thrown when column in query is wrong. It could be useful to handle this in upgrading of database. The error message contains name of the missing column and sqlite error code which in this case means: SQL error or missing database
Just share your expierience with SQL exceptions in Android. Thanks in advance!
If you really want make a list of all possible types of exceptions, then asking a community to share their experience will not be sufficient to reach the goal. I'm afraid you'll have to put a lot of more effort to complete your task. Which may be worth it, of course!
I'd suggest you to do two things:
If it's about Android, its source is really well documented and the code is clean. At first, you may start with semi-automatic approach - rgrep through the java files. You can find there a lot of information you're looking for:
Then you can go one step further - browse it manually. You may find out that SQLite*Exceptions are not the only ones that are thrown. For example, in
android.database.DatabaseUtils
you may find such a method:You'd need to find the origin of codes and document it. Or maybe it's already documented somewhere - I don't know.
To conclude, you're trying to do something that may seem easy, but in fact it's not. If you want to describe all kinds of exceptions that may occur, it requires a lot of work. Decide if that's what you want, or maybe it'll be enough to write about the most common exceptions.
By the way, I'd argue if "It could be useful to handle this in upgrading of database" in case of
SQLiteException: no such column: test (code 1)
exception. This means that schema doesn't match the code. It should fail as fast as possible - it's the best way of getting to know your code is invalid and that it needs to be fixed. But that's just my remark not concerning the essence of your question.