How to use the q.reject function in q

To help you get started, we’ve selected a few q 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 katzer / cordova-plugin-badge / node_modules / cordova-android / bin / lib / create.js View on Github external
function validatePackageName (package_name) {
    // Make the package conform to Java package types
    // http://developer.android.com/guide/topics/manifest/manifest-element.html#package
    // Enforce underscore limitation
    var msg = 'Error validating package name. ';

    if (!/^[a-zA-Z][a-zA-Z0-9_]+(\.[a-zA-Z][a-zA-Z0-9_]*)+$/.test(package_name)) {
        return Q.reject(new CordovaError(msg + 'Package name must look like: com.company.Name'));
    }

    // Class is a reserved word
    if (/\b[Cc]lass\b/.test(package_name)) {
        return Q.reject(new CordovaError(msg + '"class" is a reserved word'));
    }

    return Q.resolve();
}
github selenodium / selenodium-grid / lib / http-apps.js View on Github external
.catch(function(err) {
                // real uncatched errors must pass through
                if (err instanceof Error) {
                    return q.reject(err);
                }
                // transform response rejections into normal responses
                return err;
            });
    }
github ionic-team / ionic-cli / spec / tasks / compile.spec.js View on Github external
it('should fail if any functions throw and not log if error is not instanceof Error', function(done) {
      var error = 1;
      spyOn(ConfigXml, 'setConfigXml').andReturn(Q.reject(error));

      compile.run({}, argv, rawCliArguments).then(function() {
        expect(log.error).not.toHaveBeenCalled();
        done();
      });
    });
github monaca / monaca-lib / src / monaca.js View on Github external
      (error) => { return Q.reject(error || unknownErrorMsg); }
    );
github formio / formio / src / oauth / github.js View on Github external
refreshTokens: function(req, res, user, next) {
      return Q.reject('GitHub tokens don\'t expire for another 200,000 years. Either something went wrong or the end times fallen upon us.')
      .nodeify(next);
    }
  };
github F5Networks / f5-cloud-libs / lib / bigIp.js View on Github external
function isInitialized(bigIp) {
    if (bigIp.isInitialized) {
        return q();
    }
    return q.reject();
}
github F5Networks / f5-cloud-libs / lib / bigIpCluster.js View on Github external
BigIpCluster.prototype.createDeviceGroup = function createDeviceGroup(
    deviceGroup,
    type,
    deviceNames,
    options,
    retryOptions
) {
    let names;

    if (!deviceGroup) {
        return q.reject(new Error('deviceGroup is required'));
    }

    if (type !== 'sync-only' && type !== 'sync-failover') {
        return q.reject(new Error('type must be sync-only or sync-failover'));
    }

    if (!Array.isArray(deviceNames)) {
        names = [deviceNames];
    } else {
        names = deviceNames.slice();
    }

    const retry = retryOptions || util.DEFAULT_RETRY;

    const groupOptions = {};
    if (options) {
github MobileChromeApps / mobile-chrome-apps / dev-bin / git-up.js View on Github external
return p.then(null, function(err) {
      return Q.reject('git is not installed (or not available on your PATH). Please install it from http://git-scm.com');
    });
  });

q

A library for promises (CommonJS/Promises/A,B,D)

MIT
Latest version published 7 years ago

Package Health Score

63 / 100
Full package analysis