How to use the errs.handle function in errs

To help you get started, we’ve selected a few errs 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 pkgcloud / pkgcloud / lib / pkgcloud / mongolab / database / client / accounts.js View on Github external
exports.getAccount = function getAccount(name, callback) {
  // Check for options
  if (typeof name === 'function') {
    return errs.handle(errs.create({
      message: 'Name required for view an account.'
    }), name);
  }

  this._request({ path: 'accounts/' + name }, function (err, body) {
    return err
      ? callback(err)
      : callback(null, body.adminUser);
  });
};
github pkgcloud / pkgcloud / lib / pkgcloud / mongolab / database / client / databases.js View on Github external
exports.getDatabases = function getDatabases(owner, callback) {
  // Check for options
  if (typeof owner === 'function') {
    return errs.handle(errs.create({
      message: 'Name required for delete an account.'
    }), owner);
  }

  this._request({ path: 'accounts/' + owner + '/databases' }, function (err, body) {
    return err
      ? callback(err)
      : callback(null, body);
  });
};
github pkgcloud / pkgcloud / lib / pkgcloud / rackspace / database / client / databases.js View on Github external
exports.getDatabases = function getDatabases(options, callback) {
  var self = this,
      completeUrl = {},
      requestOptions = {};

  if (typeof options === 'function') {
    return errs.handle(errs.create({
      message: 'An instance is required for get all databases.'
    }), Array.prototype.slice.call(arguments).pop());
  }
  // Check for instance
  if (!options['instance']) {
    return errs.handle(errs.create({
      message: 'An instance is required for get all databases.'
    }), Array.prototype.slice.call(arguments).pop());
  }
  // The limit parameter for truncate results
  if (options && options.limit) {
    completeUrl.limit = options.limit;
  }
  // The offset
  if (options && options.offset) {
    completeUrl.marker = options.offset;
github pkgcloud / pkgcloud / lib / pkgcloud / mongolab / database / client / accounts.js View on Github external
exports.createAccount = function createAccount(options, callback) {
  // Check for options
  if (typeof options === 'function') {
    return errs.handle(errs.create({
      message: 'Options required for create an account.'
    }), options);
  }

  if (!options['name']) {
    return errs.handle(errs.create({
      message: 'options. Name is a required argument'
    }), callback);
  }

  if (!options['email']) {
    return errs.handle(errs.create({
      message: 'options. Email is a required argument'
    }), callback);
  }
github pkgcloud / pkgcloud / lib / pkgcloud / rackspace / database / client / instances.js View on Github external
exports.createInstance = function createInstance(options, callback) {
  var self = this,
      flavorRef,
      size;

  // Check for options
  if (!options || typeof options === 'function') {
    return errs.handle(errs.create({
      message: 'Options required for create an instance.'
    }), options);
  }

  if (!options['name']) {
    return errs.handle(errs.create({
      message: 'options. name is a required argument'
    }), callback);
  }

  if (!options['flavor']) {
    return errs.handle(errs.create({
      message: 'options. flavor is a required argument'
    }), callback);
  }
github pkgcloud / pkgcloud / lib / pkgcloud / azure2 / compute / client / servers.js View on Github external
exports.getLimits = function getLimits(callback) {
  return errs.handle(
    errs.create({ message: "Azure's API is not rate limited" }),
    callback
  );
};
github pkgcloud / pkgcloud / lib / pkgcloud / azure / compute / client / servers.js View on Github external
exports.getLimits = function getLimits(callback) {
  return errs.handle(
    errs.create({ message: "Azure's API is not rate limited" }),
    callback
  );
};
github pkgcloud / pkgcloud / lib / pkgcloud / digitalocean / compute / client / servers.js View on Github external
exports.getLimits = function getLimits(callback) {
  return errs.handle(
    errs.create({ message: 'DigitalOcean\'s API is not rate limited' }),
    callback
  );
};
github pkgcloud / pkgcloud / lib / pkgcloud / amazon / compute / client / servers.js View on Github external
exports.getLimits = function getLimits(callback) {
  return errs.handle(
    errs.create({ message: 'AWS\'s API is not rate limited' }),
    callback
  );
};
github pkgcloud / pkgcloud / lib / pkgcloud / joyent / compute / client / servers.js View on Github external
exports.getLimits = function getLimits(callback) {
  return errs.handle(
    errs.create({message: 'Joyent\'s API is not rate limited'}), callback);
};

errs

Simple error creation and passing utilities

MIT
Latest version published 10 years ago

Package Health Score

53 / 100
Full package analysis

Popular errs functions