ts-stream
Version:
Type-safe object streams with seamless support for backpressure, ending, and error handling
45 lines • 1.77 kB
JavaScript
;
/**
* Base class for wrapped errors.
*
* Copyright (C) 2015 Martin Poelstra
* License: MIT
*/
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.UnhandledAborterError = exports.WrappedError = void 0;
var BaseError_1 = require("./BaseError");
var WrappedError = /** @class */ (function (_super) {
__extends(WrappedError, _super);
function WrappedError(name, message, cause) {
var _a;
var _this = _super.call(this, name, message) || this;
_this.cause = cause;
_this.stack =
_this.stack + "\ncaused by: " + ((_a = cause.stack) !== null && _a !== void 0 ? _a : " " + cause);
return _this;
}
return WrappedError;
}(BaseError_1.default));
exports.WrappedError = WrappedError;
var UnhandledAborterError = /** @class */ (function (_super) {
__extends(UnhandledAborterError, _super);
function UnhandledAborterError(cause) {
return _super.call(this, "UnhandledAborterError", "aborter callback failed", cause) || this;
}
return UnhandledAborterError;
}(WrappedError));
exports.UnhandledAborterError = UnhandledAborterError;
//# sourceMappingURL=WrappedError.js.map