firebase-on-error

This module allows you to register callbacks to be notified when any Firebase operation reports an error. This is useful when your app has no error recovery procedure beyond asking the user to reload the page (which is not a terrible approach, since Firebase is pretty reliable!). You can also register callbacks to be notified when a write is being slow, so you can warn the user that their connection is bad and not all changes have yet been saved.
If you have a server to issue simulation auth tokens, you can also automatically get security rules debugging information attached to any permission denied exception, with no performance or bandwidth penalty to your overall app.
As a bonus, if you've registered any callbacks and Promise
is declared in your browser (whether natively or via a polyfill), then all promises returned by Firebase operations will have a finally
method polyfilled on them if necessary. You're welcome!
The module adds these new public functions to the Firebase global class:
Firebase.onError = function(callback) {...}
Firebase.offError = function(callback) {...}
Firebase.onSlowWrite = function(timeout, callback) {...}
Firebase.offSlowWrite = function(callback) {...}
Firebase.debugPermissionDeniedErrors = function(
simulatedTokenGenerator, maxSimulatedCallDuration, callFilter) {...}