index.js 1.1 KB

12345678910111213141516171819202122232425262728
  1. "use strict";
  2. var __extends = (this && this.__extends) || function (d, b) {
  3. for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
  4. function __() { this.constructor = d; }
  5. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  6. };
  7. var makeError = require('make-error');
  8. function makeErrorCause(value, _super) {
  9. if (_super === void 0) { _super = makeErrorCause.BaseError; }
  10. return makeError(value, _super);
  11. }
  12. var makeErrorCause;
  13. (function (makeErrorCause) {
  14. var BaseError = (function (_super) {
  15. __extends(BaseError, _super);
  16. function BaseError(message, cause) {
  17. _super.call(this, message);
  18. this.cause = cause;
  19. }
  20. BaseError.prototype.toString = function () {
  21. return _super.prototype.toString.call(this) + (this.cause ? "\nCaused by: " + this.cause.toString() : '');
  22. };
  23. return BaseError;
  24. }(makeError.BaseError));
  25. makeErrorCause.BaseError = BaseError;
  26. })(makeErrorCause || (makeErrorCause = {}));
  27. module.exports = makeErrorCause;
  28. //# sourceMappingURL=index.js.map