Closed
Description
[REQUIRED] Describe your environment
- Operating System version: any
- Firebase SDK version: <= 4.12.1
- Firebase Product: firestore
Any exceptions with enable persistence raise an uncaught exception, even if you attempt to catch on the Promise.
Steps to reproduce:
Call in two tabs:
firestore.enablePersistence().then(() => {}, () => {})
or firestore.enablePersistence().catch(() => {})
You'll get an uncaught exception RE Firestore persistence already having been initialized.
The exception should have be caught with the Promise's reject argument / catch method and not bubble up further, which raises an uncaught exception. Developers currently need to wrap in a try/catch which isn't great ergo.
This hits us here: https://github.com/angular/angularfire2/blob/e343f137bd0ca9a1d958253b58104c64acbe3944/src/firestore/firestore.ts#L123