UNPKG

typescript-dotnet-amd

Version:

A JavaScript-Friendly .NET Based TypeScript Library.

7 lines 1.31 kB
/*! * @author electricessence / https://github.com/electricessence/ * Licensing: MIT https://github.com/electricessence/TypeScript.NET/blob/master/LICENSE.md * Based upon: https://msdn.microsoft.com/en-us/library/System.Exception%28v=vs.110%29.aspx */ define(["require","exports"],function(require,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var NAME="Exception",Exception=function(){function Exception(message,innerException,beforeSealing){this.message=message,this.name=this.getName(),this.data={},innerException&&(this.data.innerException=innerException),beforeSealing&&beforeSealing(this);try{var stack=eval("new Error()").stack;stack=stack&&stack.replace(/^Error\n/,"").replace(/(.|\n)+\s+at new.+/,"")||"",this.stack=this.toStringWithoutBrackets()+stack}catch(ex){this.stack=""}Object.freeze(this)}return Exception.prototype.getName=function(){return NAME},Exception.prototype.toString=function(){return"["+this.toStringWithoutBrackets()+"]"},Exception.prototype.toStringWithoutBrackets=function(){var t=this,e=t.message;return t.name+(e?": "+e:"")},Exception.prototype.dispose=function(){var t=this.data;for(var e in t)t.hasOwnProperty(e)&&delete t[e]},Exception}();exports.Exception=Exception,exports["default"]=Exception}); //# sourceMappingURL=Exception.js.map