var __extends = (this && this.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; /** * Convenience to throw an Error with 'unimplemented' as the message. * @return {?} */ export function unimplemented() { throw new Error('unimplemented'); } /** * \@stable */ export var BaseError = (function (_super) { __extends(BaseError, _super); /** * @param {?} message */ function BaseError(message) { _super.call(this, message); // Errors don't use current this, instead they create a new instance. // We have to do forward all of our api to the nativeInstance. // TODO(bradfordcsmith): Remove this hack when // google/closure-compiler/issues/2102 is fixed. var nativeError = new Error(message); this._nativeError = nativeError; } Object.defineProperty(BaseError.prototype, "message", { /** * @return {?} */ get: function () { return this._nativeError.message; }, /** * @param {?} message * @return {?} */ set: function (message) { this._nativeError.message = message; }, enumerable: true, configurable: true }); Object.defineProperty(BaseError.prototype, "name", { /** * @return {?} */ get: function () { return this._nativeError.name; }, enumerable: true, configurable: true }); Object.defineProperty(BaseError.prototype, "stack", { /** * @return {?} */ get: function () { return ((this._nativeError)).stack; }, /** * @param {?} value * @return {?} */ set: function (value) { ((this._nativeError)).stack = value; }, enumerable: true, configurable: true }); /** * @return {?} */ BaseError.prototype.toString = function () { return this._nativeError.toString(); }; return BaseError; }(Error)); function BaseError_tsickle_Closure_declarations() { /** * \@internal * * @type {?} */ BaseError.prototype._nativeError; } /** * \@stable */ export var WrappedError = (function (_super) { __extends(WrappedError, _super); /** * @param {?} message * @param {?} error */ function WrappedError(message, error) { _super.call(this, message + " caused by: " + (error instanceof Error ? error.message : error)); this.originalError = error; } Object.defineProperty(WrappedError.prototype, "stack", { /** * @return {?} */ get: function () { return (((this.originalError instanceof Error ? this.originalError : this._nativeError))) .stack; }, enumerable: true, configurable: true }); return WrappedError; }(BaseError)); function WrappedError_tsickle_Closure_declarations() { /** @type {?} */ WrappedError.prototype.originalError; } //# sourceMappingURL=errors.js.map