Merge pull request #245 from ForbesLindesay/patch-1
authorMihai Bazon <mihai.bazon@gmail.com>
Tue, 10 Dec 2013 18:23:29 +0000 (10:23 -0800)
committerMihai Bazon <mihai.bazon@gmail.com>
Tue, 10 Dec 2013 18:23:29 +0000 (10:23 -0800)
Make `DefaultsError` a real `Error` object

1  2 
lib/utils.js

diff --cc lib/utils.js
@@@ -85,11 -86,9 +86,13 @@@ function DefaultsError(msg, defs) 
      this.msg = msg;
      this.defs = defs;
  };
+ DefaultsError.prototype = Object.create(Error.prototype)
+ DefaultsError.prototype.constructor = DefaultsError
  
 +DefaultsError.croak = function(msg, defs) {
 +    throw new DefaultsError(msg, defs);
 +};
 +
  function defaults(args, defs, croak) {
      if (args === true)
          args = {};