Skip to content
This repository has been archived by the owner on Sep 7, 2022. It is now read-only.

Throw catchable error when firebase.js wasn't loaded #97

Open
filiph opened this issue Mar 23, 2017 · 4 comments
Open

Throw catchable error when firebase.js wasn't loaded #97

filiph opened this issue Mar 23, 2017 · 4 comments

Comments

@filiph
Copy link
Contributor

filiph commented Mar 23, 2017

initializeApp() should throw something like JsNotLoadedError when the wrapped JS functions and objects aren't available.

For example, when using the web app offline, firebase.js won't be loaded, and initializeApp() will die horribly with a null pointer exception, thus taking the whole app down.

@Janamou
Copy link
Contributor

Janamou commented Mar 26, 2017

Will do, thanks!

@kevmoo
Copy link
Contributor

kevmoo commented Jun 9, 2017

As of ef44d79 we're pretty close. Leaving this open, since there are a number of APIs that are still not throwing as you'd expect.

@kevmoo kevmoo added the bug label Nov 20, 2019
@Ehesp
Copy link

Ehesp commented May 13, 2020

Hey @kevmoo any updates on this one? We're implementing web support on FlutterFire and currently we're having to do hard try-catch blocks on the error, e.g:

	  try {
        app = firebase.app();
      } catch (e) {
        if (e.toString().contains("Cannot read property 'app' of undefined")) {
          throw coreNotInitialized();
        }

        rethrow;
      }

I noticed there is an internal _firebaseNotLoaded function which doesn't seem to be capturing this issue. Thanks!

@russellwheatley
Copy link

Our CI has been failing because the error message for this changed: 81dc72f (#6977)

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

No branches or pull requests

5 participants