Break exception class out into a standalone module

This commit is contained in:
kpdecker
2013-10-01 20:52:14 -05:00
parent 80b748ad3e
commit 6a23391a9a
7 changed files with 26 additions and 21 deletions
-13
View File
@@ -1,19 +1,6 @@
var toString = Object.prototype.toString,
isArray = Array.isArray;
var errorProps = ['description', 'fileName', 'lineNumber', 'message', 'name', 'number', 'stack'];
export function Exception(message) {
var tmp = Error.prototype.constructor.apply(this, arguments);
// Unfortunately errors are not enumerable in Chrome (at least), so `for prop in tmp` doesn't work.
for (var idx = 0; idx < errorProps.length; idx++) {
this[errorProps[idx]] = tmp[errorProps[idx]];
}
};
Exception.prototype = new Error();
// Build out our basic SafeString type
export function SafeString(string) {
this.string = string;