Skip to content

[cloud_firestore] Catch exceptions for transactions on Android - #84

Merged
collinjackson merged 2 commits into
firebase:masterfrom
creativecreatorormaybenot:catch-transaction-crashes
Sep 4, 2019
Merged

collinjackson merged 2 commits into
firebase:masterfrom
creativecreatorormaybenot:catch-transaction-crashes

Conversation

@creativecreatorormaybenot

@creativecreatorormaybenot creativecreatorormaybenot commented Sep 3, 2019 •

Copy link
Copy Markdown
Contributor

This should resolve #70.

I assume that the RuntimeExceptions I am seeing there happen in the doInBackground AsyncTask of Transaction#set, which is why I added a try-catch block there.

Transaction#update and Transaction#get already had try-catch blocks, however, they only caught IllegalStateException's and since I got RuntimeExceptions and there is no need to be specific about the type of exception when only e.getMessage is called anyway, I generalized the catch block for those as well.

Additionally, I applied the same logic to Transaction#delete, just to be consistent.

@collinjackson collinjackson left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Thank you.

@creativecreatorormaybenot

Copy link
Copy Markdown
Contributor Author

@eli-front

Copy link
Copy Markdown

has this been released?

@firebase firebase locked and limited conversation to collaborators Aug 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[cloud_firestore] Crash "An error occurred while executing doInBackground()"

3 participants