How to use the common-errors.helpers function in common-errors

To help you get started, we’ve selected a few common-errors 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 dowjones / distribucache / lib / decorators / MarshallDecorator.js View on Github external
var inherits = require('util').inherits,
  MarshallingError = require('common-errors').helpers
    .generateClass('MarshallingError'),
  BaseDecorator = require('./BaseDecorator');

module.exports = MarshallDecorator;

/**
 * Decorator which takes care of marshalling
 * the data to / from the cache.
 *
 * @param {Cache} cache
 * @param {Object} [config]
 */

function MarshallDecorator(cache) {
  BaseDecorator.call(this, cache);
}
github dowjones / distribucache / lib / util.js View on Github external
var crypto = require('crypto'),
  once = require('lodash/function/once'),
  TimeoutError = require('common-errors').helpers
    .generateClass('TimeoutError'),
  HUMAN_IVAL_RE = /([\d.]+)\s?(ms|sec|min|hour|day|week|month|year)(?:ond|ute)?s?/,
  slice = Array.prototype.slice;

/**
 * Create an md5 hash
 *
 * @param {String} str input
 * @returns {String} hash
 */

exports.createHash = function (str) {
  return crypto
    .createHash('md5')
    .update(str.toString())
    .digest('hex');
github dowjones / distribucache / lib / Cache.js View on Github external
var EventEmitter = require('events').EventEmitter,
  MarshallingError = require('common-errors').helpers
    .generateClass('MarshallingError'),
  inherits = require('util').inherits,
  joi = require('joi'),
  async = require('async'),
  createHash = require('./util').createHash;

module.exports = Cache;

/**
 * Basic Redis-backed cache
 *
 * @param {Object} [config]
 * @param {String} [config.namespace]
 */

function Cache(client, config) {