Skip to content

Reject with indexeddb errors in RemoteConfig.fetch() #2381

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

Merged
merged 2 commits into from
Nov 26, 2019
Merged

Conversation

Feiyang1
Copy link
Member

await this._storageCache.setLastFetchStatus(lastFetchStatus); in the catch block can fail (e.g. in envs where indexeddb is not available), but the caller can't catch it because we don't catch it and the program just throws.

Refactored the code to use async await directly instead of wrapping fetch inside a Promise callback, so all errors will be caught and rejected properly.

An alternative considered is to try catch in the catch block, then reject, but it makes the code more complicated and less readable.

It fixes #2373 (comment).

@Feiyang1 Feiyang1 changed the title Fei rc idb fix Reject with indexeddb errors in RemoteConfig.fetch() Nov 26, 2019
Copy link

@erikeldridge erikeldridge left a comment

Choose a reason for hiding this comment

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

Thx, @Feiyang1 !

@Feiyang1 Feiyang1 merged commit ba2ff35 into master Nov 26, 2019
@Feiyang1 Feiyang1 deleted the fei-rc-idb-fix branch November 26, 2019 01:10
@hsubox76 hsubox76 added this to the 7.5.1 milestone Dec 10, 2019
@firebase firebase locked and limited conversation to collaborators Dec 26, 2019
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.

Remote config throws error in Firefox private browsing mode
3 participants