I'd like to log any Exceptions that may be occurring on my app's onUpgrade method of SQLiteOpenHelper, so that I may fix any query issues in subsequent updates.
With regards to Exceptions, the documentation only mentions the following:
This method executes within a transaction. If an exception is thrown, all changes will automatically be rolled back.
Does anyone have any idea on how I can go about determining why my onUpgrade method failed, in my Android app?
You can wrap your onUpgrade()
in a try
-catch
that logs and rethrows the exception. Along the lines of:
try {
db.execSQL(/* upgrades */);
} catch (Throwable t) {
Log.w(TAG, "onUpgrade failed", t);
throw t;
}