flex-plugins-utils-exception
Advanced tools
Comparing version 0.9.0 to 0.10.0
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var TwilioError_1 = require("./lib/TwilioError"); | ||
exports.TwilioError = TwilioError_1.default; | ||
Object.defineProperty(exports, "TwilioError", { enumerable: true, get: function () { return TwilioError_1.default; } }); | ||
var TwilioApiError_1 = require("./lib/TwilioApiError"); | ||
exports.TwilioApiError = TwilioApiError_1.default; | ||
Object.defineProperty(exports, "TwilioApiError", { enumerable: true, get: function () { return TwilioApiError_1.default; } }); | ||
//# sourceMappingURL=index.js.map |
@@ -0,3 +1,5 @@ | ||
export declare type Constructable<T> = new (...args: any[]) => T; | ||
export default class TwilioError extends Error { | ||
constructor(msg?: string); | ||
instanceOf: <T extends Error>(klass: Constructable<T>) => boolean; | ||
} |
@@ -20,2 +20,15 @@ "use strict"; | ||
var _this = _super.call(this, msg) || this; | ||
_this.instanceOf = function (klass) { | ||
var instance = _this; | ||
while (instance && instance !== Object.prototype) { | ||
if (!instance || !instance.constructor || !instance.constructor.name) { | ||
return false; | ||
} | ||
if (klass.name === instance.constructor.name) { | ||
return true; | ||
} | ||
instance = Object.getPrototypeOf(instance); | ||
} | ||
return false; | ||
}; | ||
Object.setPrototypeOf(_this, TwilioError.prototype); | ||
@@ -22,0 +35,0 @@ return _this; |
{ | ||
"name": "flex-plugins-utils-exception", | ||
"version": "0.9.0", | ||
"version": "0.10.0", | ||
"description": "Flex Plugins Exceptions", | ||
@@ -42,3 +42,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "8fa4501d2e8e3481deb39738a120d596b8d2bc49" | ||
"gitHead": "d9ab3fa727939346c47bac888c820fd93fd2131c" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
8060
92