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

Wrong Exception Message in Transactions #1183

Closed
shiva-6 opened this issue Jan 31, 2023 · 3 comments · Fixed by #1503
Closed

Wrong Exception Message in Transactions #1183

shiva-6 opened this issue Jan 31, 2023 · 3 comments · Fixed by #1503
Assignees
Labels
api: firestore Issues related to the googleapis/java-firestore API.

Comments

@shiva-6
Copy link

shiva-6 commented Jan 31, 2023

I understand internally we use writebatch for transactions but the error messages should be related to feature. So, If I was using transactions outside the method, It throws an exception but saying writebatch has been already commited rather than saying transaction.

Environment details

  1. API : runTransaction
  2. OS type and version: windows11
  3. Java version: 1.8
  4. version(s):

Steps to reproduce

  1. I have added sample code, Please check to reproduce the issue

Code example

// example
   public static void solve() {
        // Create your client
        // Firestore firestoreClient = 
        Transaction t = null;
        try {
            t = firestoreClient.runTransaction(transaction -> {
                // do something
                return transaction;
            }).get();
            t.get(firestoreClient.document("users/me"));
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

Stack trace

java.lang.IllegalStateException: Cannot modify a WriteBatch that has already been committed. at com.google.common.base.Preconditions.checkState(Preconditions.java:502) at com.google.cloud.firestore.UpdateBuilder.verifyNotCommitted(UpdateBuilder.java:158) at com.google.cloud.firestore.UpdateBuilder.performUpdate(UpdateBuilder.java:519) at com.google.cloud.firestore.UpdateBuilder.update(UpdateBuilder.java:356)

External references such as API reference guides

Any additional information below

@product-auto-label product-auto-label bot added the api: firestore Issues related to the googleapis/java-firestore API. label Jan 31, 2023
@dconeybe dconeybe self-assigned this Jan 31, 2023
@dconeybe
Copy link
Contributor

dconeybe commented Feb 2, 2023

Thank you for this bug report. I'll take a look and see what we can do.

@shiva-6
Copy link
Author

shiva-6 commented Feb 14, 2023

@dconeybe any update on this?

@dconeybe
Copy link
Contributor

No update yet. Is this causing you issues? I've prioritized it low compared to other work because my understanding was that this is purely cosmetic, in that you'd like to see a better error message, but does not affect functionality at all. Is that understanding correct?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: firestore Issues related to the googleapis/java-firestore API.
Projects
None yet
2 participants