index.js
function connectionCheck(error, diagnose) {
    var servers = diagnose.knownServers;

    // Nothing to check so we fail immediately.
    if (!servers || servers.length === 0) {
      throw new ServerDownError(error);
    }

    // We check all the servers that the user asked to check. If none respond,
    // we blame the network. Otherwise, we blame the server.
    return Promise.all(servers.map(function urlToAjax(url) {
      // eslint-disable-next-line no-use-before-define
      return ajax({ url: dedupURL(normalizeURL(url)), timeout: 1000 })
        .reflect();
    })).filter(function filterSuccessfulServers(result) {
      return result.isFulfilled();
    }).then(function checkAnyFullfilled(fulfilled) {
      if (fulfilled.length === 0) {
        throw new NetworkDownError(error);
      }

      throw new ServerDownError(error);
    });
  }
function connectionCheck(error, diagnose) {
    var servers = diagnose.knownServers;

    // Nothing to check so we fail immediately.
    if (!servers || servers.length === 0) {
      throw new ServerDownError(error);
    }

    // We check all the servers that the user asked to check. If none respond,
    // we blame the network. Otherwise, we blame the server.
    return Promise.all(servers.map(function urlToAjax(url) {
      // eslint-disable-next-line no-use-before-define
      return ajax({ url: dedupURL(normalizeURL(url)), timeout: 1000 })
        .reflect();
    })).filter(function filterSuccessfulServers(result) {
      return result.isFulfilled();
    }).then(function checkAnyFullfilled(fulfilled) {
      if (fulfilled.length === 0) {
        throw new NetworkDownError(error);
      }

      throw new ServerDownError(error);
    });
  }
function connectionCheck ( error , diagnose ) { var servers = diagnose . knownServers ; // Nothing to check so we fail immediately. if ( ! servers || servers . length === 0 ) { throw new ServerDownError ( error ) ; } // We check all the servers that the user asked to check. If none respond, // we blame the network. Otherwise, we blame the server. return Promise . all ( servers . map ( function urlToAjax ( url ) { // eslint-disable-next-line no-use-before-define return ajax ( { url : dedupURL ( normalizeURL ( url ) ) , timeout : 1000 } ) . reflect ( ) ; } ) ) . filter ( function filterSuccessfulServers ( result ) { return result . isFulfilled ( ) ; } ) . then ( function checkAnyFullfilled ( fulfilled ) { if ( fulfilled . length === 0 ) { throw new NetworkDownError ( error ) ; } throw new ServerDownError ( error ) ; } ) ; }
This is called once we know a) the browser is not offline but b) we cannot reach the server that should serve our request.
This is called once we know a ) the browser is not offline but b ) we cannot reach the server that should serve our request .