function _findCluster() {
    this._log.debug("Finding cluster for user " + this.identity.username);

    // This should ideally use UserAPI10Client but the legacy hackiness is
    // strong with this code.
    let fail;
    let url = this.service.userAPIURI + this.identity.username + "/node/weave";
    let res = this.service.resource(url);
    try {
      let node = res.get();
      switch (node.status) {
        case 400:
          this.service.status.login = LOGIN_FAILED_LOGIN_REJECTED;
          fail = "Find cluster denied: " + this.service.errorHandler.errorStr(node);
          break;
        case 404:
          this._log.debug("Using serverURL as data cluster (multi-cluster support disabled)");
          return this.service.serverURL;
        case 0:
        case 200:
          if (node == "null") {
            node = null;
          }
          this._log.trace("_findCluster successfully returning " + node);
          return node;
        default:
          this.service.errorHandler.checkServerError(node);
          fail = "Unexpected response code: " + node.status;
          break;
      }
    } catch (e) {
      this._log.debug("Network error on findCluster");
      this.service.status.login = LOGIN_FAILED_NETWORK_ERROR;
      this.service.errorHandler.checkServerError(e);
      fail = e;
    }
    throw fail;
  }
/**
   * Obtain the cluster for the current user.
   *
   * Returns the string URL of the cluster or null on error.
   */
Obtain the cluster for the current user.
Returns the string URL of the cluster or null on error.
Obtain the cluster for the current user . Returns the string URL of the cluster or null on error .
function _findCluster() {
    this._log.debug("Finding cluster for user " + this.identity.username);
    let fail;
    let url = this.service.userAPIURI + this.identity.username + "/node/weave";
    let res = this.service.resource(url);
    try {
      let node = res.get();
      switch (node.status) {
        case 400:
          this.service.status.login = LOGIN_FAILED_LOGIN_REJECTED;
          fail = "Find cluster denied: " + this.service.errorHandler.errorStr(node);
          break;
        case 404:
          this._log.debug("Using serverURL as data cluster (multi-cluster support disabled)");
          return this.service.serverURL;
        case 0:
        case 200:
          if (node == "null") {
            node = null;
          }
          this._log.trace("_findCluster successfully returning " + node);
          return node;
        default:
          this.service.errorHandler.checkServerError(node);
          fail = "Unexpected response code: " + node.status;
          break;
      }
    } catch (e) {
      this._log.debug("Network error on findCluster");
      this.service.status.login = LOGIN_FAILED_NETWORK_ERROR;
      this.service.errorHandler.checkServerError(e);
      fail = e;
    }
    throw fail;
  }
function _findCluster ( ) { this . _log . debug ( "Finding cluster for user " + this . identity . username ) ; let fail ; let url = this . service . userAPIURI + this . identity . username + "/node/weave" ; let res = this . service . resource ( url ) ; try { let node = res . get ( ) ; switch ( node . status ) { case 400 : this . service . status . login = LOGIN_FAILED_LOGIN_REJECTED ; fail = "Find cluster denied: " + this . service . errorHandler . errorStr ( node ) ; break ; case 404 : this . _log . debug ( "Using serverURL as data cluster (multi-cluster support disabled)" ) ; return this . service . serverURL ; case 0 : case 200 : if ( node == "null" ) { node = null ; } this . _log . trace ( "_findCluster successfully returning " + node ) ; return node ; default : this . service . errorHandler . checkServerError ( node ) ; fail = "Unexpected response code: " + node . status ; break ; } } catch ( e ) { this . _log . debug ( "Network error on findCluster" ) ; this . service . status . login = LOGIN_FAILED_NETWORK_ERROR ; this . service . errorHandler . checkServerError ( e ) ; fail = e ; } throw fail ; }
Obtain the cluster for the current user.
Obtain the cluster for the current user .
// This should ideally use UserAPI10Client but the legacy hackiness is // strong with this code.