code: function createProfileWatchErrorHandler(dispatch, firebase) {
    const { config: { onProfileListenerError, logErrors } } = firebase._
    return function handleProfileError(err) {
      if (logErrors) {
        // eslint-disable-next-line no-console
        console.error(`Error with profile listener: ${err.message || ''}`, err)
      }
      if (isFunction(onProfileListenerError)) {
        const factoryResult = onProfileListenerError(err, firebase)
        // Return factoryResult if it is a promise
        if (isFunction(factoryResult.then)) {
          return factoryResult
        }
      }
      return Promise.reject(err)
    }
  }
docs: Creates a function for handling errors from profile watcher. Used for
  both RTDB and Firestore.
  @param {Function} dispatch - Action dispatch function
  @param {Object} firebase - Internal firebase object
  @return {Function} Profile watch error handler function
  @private