How to use the errs.create 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 cloudant / nodejs-cloudant / lib / nano.js View on Github external
if (!parsed.message && (parsed.reason || parsed.error)) {
        parsed.message = (parsed.reason || parsed.error);
      }

      // fix cloudant issues where they give an erlang stacktrace as js
      delete parsed.stack;

      callback(errs.merge({
        message: 'couch returned ' + rh.statusCode,
        scope: 'couch',
        statusCode: rh.statusCode,
        request: req,
        headers: rh,
        errid: 'non_200'
      }, errs.create(parsed)));
    });
  }
github pkgcloud / pkgcloud / lib / pkgcloud / azure / utils / azureApi.js View on Github external
createVM = function (client, options, vmOptions, callback) {
  // check OS type of image to determine if we are creating a linux or windows VM
  switch (vmOptions.image.OSImage.OS.toLowerCase()) {
    case 'linux':
      createLinuxVM(client, options, vmOptions, callback);
      break;
    case 'windows':
      createWindowsVM(client, options, vmOptions, callback);
      break;
    default:
      callback(errs.create({message: 'Unknown Image OS: ' + vmOptions.image.OS}));
      break;
  }
};
github pkgcloud / pkgcloud / lib / pkgcloud / azure / utils / azureApi.js View on Github external
var createVM = function(client, options, vmOptions, callback) {
  // check OS type of image to determine if we are creating a linux or windows VM
  switch(vmOptions.image.OS.toLowerCase()) {
    case 'linux':
      createLinuxVM(client, options, vmOptions, callback);
      break;
    case 'windows':
      createWindowsVM(client, options, vmOptions, callback);
      break;
    default:
      callback(errs.create({message: 'Unknown Image OS: ' + vmOptions.image.OS}));
      break;
  }
};
github pkgcloud / pkgcloud / lib / pkgcloud / azure / compute / client / azure / azureServer.js View on Github external
AzureServer.prototype.createVM = function(callback) {
  // check OS type of image to determine if we are creating a linux or windows VM
  switch(this.image.OS.toLowerCase()) {
    case 'linux':
      this.createLinuxVM(callback);
      break;
    case 'windows':
      this.createWindowsVM(callback);
      break;
    default:
      callback(errs.create({message: 'Unknown Image OS: ' + this.image.OS}));
      break;
  }
};
github pkgcloud / pkgcloud / lib / pkgcloud / core / base / client.js View on Github external
return function (err, res, body) {
    if (err) {
      return callback(err);
    }

    var err2 = self._parseError(res, body);

    if (err2) {
      self.emit('log::error', 'Error during provider response', err2);
      return callback(errs.create(err2));
    }

    self.emit('log::trace', 'Provider Response', {
      href: res.request.uri.href,
      method: res.request.method,
      headers: res.headers,
      statusCode: res.statusCode
    });

    callback(err, body, res);
  };
};
github pkgcloud / pkgcloud / lib / pkgcloud / azure2 / compute / client / servers.js View on Github external
exports.renameServer = function renameServer(server, name, callback) {
  return errs.handle(
    errs.create({ message: 'Not supported by Azure.' }),
    callback
  );
};
github pkgcloud / pkgcloud / lib / pkgcloud / azure / compute / client / servers.js View on Github external
exports.renameServer = function renameServer(server, name, callback) {
  return errs.handle(
    errs.create({ message: 'Not supported by Azure.' }),
    callback
  );
};
github pkgcloud / pkgcloud / lib / pkgcloud / digitalocean / compute / client / servers.js View on Github external
['flavor', 'image', 'name'].forEach(function (member) {
    if (!options[member]) {
      return errs.handle(
        errs.create({ message: 'options.' + member + ' is a required argument.' }),
        callback
      );
    }
  });
github pkgcloud / pkgcloud / lib / pkgcloud / joyent / compute / client / images.js View on Github external
exports.destroyImage = function destroyImage(image, callback) {
  return errs.handle(
    errs.create({ message: 'Not supported by joyent' }),
    callback
  );
};
github godaddy / warehouse.ai / lib / npm / tagger.js View on Github external
this.Package.get(pkg, function (err, pack) {
    if (err) { return callback(err); }

    if (!pack) {
      return callback(errs.create({
        message: `'${pkg}' is not in the registry.`,
        status: 404
      }));
    }

    callback(null, pack.distTags);
  });
};

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