Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get SQLException if anything happened when inserting #89

Open
a-thomas opened this issue Oct 26, 2015 · 0 comments
Open

Get SQLException if anything happened when inserting #89

a-thomas opened this issue Oct 26, 2015 · 0 comments

Comments

@a-thomas
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant