sprinkles
sprinkles copied to clipboard
Get SQLException if anything happened when inserting
Hi there,
When inserting in db, the Transaction
uses SQLLiteDatabase.insert()
method, so Transaction
returns -1
if any errors occured. It might be interesting to replace it by SQLLiteDatabase.insertOrThrow()
which is the same but without catching SQLException
.
public long insert(String table, String nullColumnHack, ContentValues values) {
try {
return insertWithOnConflict(table, nullColumnHack, values, CONFLICT_NONE);
} catch (SQLException e) {
Log.e(TAG, "Error inserting " + values, e);
return -1;
}
}
Replacing it could be dangerous for current Sprinkles users when it comes to upgrade. It should be more clever to provide an alternative way of saving the Transaction
.
It should be helpful in case you want to figure out the origin of an error in production as Log.e()
is unusable.