ErrorWithCause.js 414 B

123456789101112131415161718192021
  1. "use strict";
  2. const hasProperty = require("./hasProperty.js");
  3. class ErrorWithCause extends Error {
  4. constructor(message, options) {
  5. if (options === void 0) {
  6. options = {};
  7. }
  8. super(message);
  9. this.cause = options.cause;
  10. if (this.cause && hasProperty(this.cause, 'isNetworkError')) {
  11. this.isNetworkError = this.cause.isNetworkError;
  12. }
  13. }
  14. }
  15. module.exports = ErrorWithCause;