From dfa395f6ff405bbea018dbc24b31cbd49a9ac6ef Mon Sep 17 00:00:00 2001 From: Forbes Lindesay Date: Mon, 22 Jul 2013 01:44:03 +0100 Subject: [PATCH] Make `DefaultsError` a real `Error` object --- lib/utils.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/utils.js b/lib/utils.js index 73964a09..20f9a8e1 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -82,9 +82,12 @@ function repeat_string(str, i) { }; function DefaultsError(msg, defs) { + Error.call(this, msg) this.msg = msg; this.defs = defs; }; +DefaultsError.prototype = Object.create(Error.prototype) +DefaultsError.prototype.constructor = DefaultsError function defaults(args, defs, croak) { if (args === true) -- 2.34.1