How to use the @firebase/webchannel-wrapper.ErrorCode.TIMEOUT function in @firebase/webchannel-wrapper

To help you get started, we’ve selected a few @firebase/webchannel-wrapper examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github firebase / firebase-js-sdk / packages / firestore / src / platform_browser / webchannel_connection.ts View on Github external
xhr.listenOnce(EventType.COMPLETE, () => {
        try {
          switch (xhr.getLastErrorCode()) {
            case ErrorCode.NO_ERROR:
              const json = xhr.getResponseJson() as Resp;
              log.debug(LOG_TAG, 'XHR received:', JSON.stringify(json));
              resolve(json);
              break;
            case ErrorCode.TIMEOUT:
              log.debug(LOG_TAG, 'RPC "' + rpcName + '" timed out');
              reject(
                new FirestoreError(Code.DEADLINE_EXCEEDED, 'Request time out')
              );
              break;
            case ErrorCode.HTTP_ERROR:
              const status = xhr.getStatus();
              log.debug(
                LOG_TAG,
                'RPC "' + rpcName + '" failed with status:',
                status,
                'response text:',
                xhr.getResponseText()
              );
              if (status > 0) {
                const responseError = (xhr.getResponseJson() as WebChannelError)

@firebase/webchannel-wrapper

A wrapper of the webchannel packages from closure-library for use outside of a closure compiled application

Apache-2.0
Latest version published 18 days ago

Package Health Score

95 / 100
Full package analysis

Similar packages