lib/error.js
function PrimitiveError(code, metadata, cause) {
  if (code === undefined || code === null) {
    throw new TypeError('`code` is a required argument!');
  }

  PrimitiveError.super_.call(this, this.constructor.ERRORS[code]);

  if (metadata instanceof Error) {
    cause = metadata;
    metadata = undefined;
  }

  /**
   * Backing field to store an object's state
   *
   * @type {Object}
   * @private
   */
  this._properties = {
    code: code,
    metadata: metadata,
    cause: cause
  };
}
function PrimitiveError(code, metadata, cause) {
  if (code === undefined || code === null) {
    throw new TypeError('`code` is a required argument!');
  }

  PrimitiveError.super_.call(this, this.constructor.ERRORS[code]);

  if (metadata instanceof Error) {
    cause = metadata;
    metadata = undefined;
  }

  /**
   * Backing field to store an object's state
   *
   * @type {Object}
   * @private
   */
  this._properties = {
    code: code,
    metadata: metadata,
    cause: cause
  };
}
function PrimitiveError ( code , metadata , cause ) { if ( code === undefined || code === null ) { throw new TypeError ( '`code` is a required argument!' ) ; } PrimitiveError . super_ . call ( this , this . constructor . ERRORS [ code ] ) ; if ( metadata instanceof Error ) { cause = metadata ; metadata = undefined ; } /**
   * Backing field to store an object's state
   *
   * @type {Object}
   * @private
   */ this . _properties = { code : code , metadata : metadata , cause : cause } ; }
A base class for all errors

This class inherits from the JavaScript Error class, and then parasitically
inherits from PrimitiveObject. Multiple inheritance isn't pretty!

@param {String} code A unique code identifying the error
@param {Object} [metadata] Metadata related to the error
@param {Error} [cause] The original error, if any, to be wrapped
A base class for all errors