I have some code in one of my android apps that catches SQLException, but I’ve recently found that it’s not catching SQLiteException’s. Clearly, SQLiteException is a child of SQLException, so why isn’t it being caught? Here’s some code I’m using.
try {
... // something here that will throw an SQLiteException
} catch (SQLException e) {
e.printStackTrace();
}
Is my assumption correct that I should be catching SQLiteException?
If it matters at all, i’m using this code not inside of an Activity, but inside of a class that extends the Application class.
As a side note, I did add an additional catch( Exception e ){} to see if that would work and it did indeed work as expected.
There are two types of SQLException:
make sure you are using the first not the second.