abstract-object
Advanced tools
Comparing version 1.3.3 to 1.3.4
@@ -69,6 +69,9 @@ (function() { | ||
module.exports.createError = createError = function(aType, aErrorCode) { | ||
module.exports.createError = createError = function(aType, aErrorCode, ErrorClass) { | ||
var Err; | ||
AbstractError[aType] = aErrorCode; | ||
AbstractError["is" + aType] = (function(aErrorCode, aType) { | ||
if (ErrorClass == null) { | ||
ErrorClass = AbstractError; | ||
} | ||
ErrorClass[aType] = aErrorCode; | ||
ErrorClass["is" + aType] = (function(aErrorCode, aType) { | ||
return function(err) { | ||
@@ -78,15 +81,18 @@ return err.code === aErrorCode || ((err.code == null) && err.message && err.message.substring(0, aType.length) === aType); | ||
})(aErrorCode, aType); | ||
AbstractError.prototype[firstLower(aType)] = (function(aIsMethodName) { | ||
ErrorClass.prototype[firstLower(aType)] = (function(aIsMethodName, ErrorClass) { | ||
return function() { | ||
return AbstractError[aIsMethodName](this); | ||
return ErrorClass[aIsMethodName](this); | ||
}; | ||
})("is" + aType); | ||
})("is" + aType, ErrorClass); | ||
return Err = (function() { | ||
inherits(Err, AbstractError); | ||
inherits(Err, ErrorClass); | ||
function Err(msg) { | ||
function Err(msg, aCode) { | ||
if (aCode == null) { | ||
aCode = aErrorCode; | ||
} | ||
if ((msg == null) || msg === "") { | ||
msg = aType; | ||
} | ||
AbstractError.call(this, msg, aErrorCode); | ||
Err.__super__.constructor.call(this, msg, aCode); | ||
} | ||
@@ -93,0 +99,0 @@ |
{ | ||
"name": "abstract-object", | ||
"version": "1.3.3", | ||
"version": "1.3.4", | ||
"description": "AbstractObject with Object State Events Support, RefObject with RefCount and AddRef/Release Support.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/snowyu/abstract-object", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
49561
451