main
Last change
on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
1.4 KB
|
Rev | Line | |
---|
[d24f17c] | 1 | "use strict";
|
---|
| 2 |
|
---|
| 3 | var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
|
---|
| 4 | exports.__esModule = true;
|
---|
| 5 | exports.default = void 0;
|
---|
| 6 | var _ApiDOMAggregateError = _interopRequireDefault(require("./ApiDOMAggregateError.cjs"));
|
---|
| 7 | class ApiDOMError extends Error {
|
---|
| 8 | static [Symbol.hasInstance](instance) {
|
---|
| 9 | // we want to ApiDOMAggregateError to act as if ApiDOMError was its superclass
|
---|
| 10 | return super[Symbol.hasInstance](instance) || Function.prototype[Symbol.hasInstance].call(_ApiDOMAggregateError.default, instance);
|
---|
| 11 | }
|
---|
| 12 | constructor(message, options) {
|
---|
| 13 | super(message, options);
|
---|
| 14 | this.name = this.constructor.name;
|
---|
| 15 | if (typeof message === 'string') {
|
---|
| 16 | this.message = message;
|
---|
| 17 | }
|
---|
| 18 | if (typeof Error.captureStackTrace === 'function') {
|
---|
| 19 | Error.captureStackTrace(this, this.constructor);
|
---|
| 20 | } else {
|
---|
| 21 | this.stack = new Error(message).stack;
|
---|
| 22 | }
|
---|
| 23 |
|
---|
| 24 | /**
|
---|
| 25 | * This needs to stay here until our minimum supported version of Node.js is >= 16.9.0.
|
---|
| 26 | * Node.js is >= 16.9.0 supports error causes natively.
|
---|
| 27 | */
|
---|
| 28 | if (options != null && typeof options === 'object' && Object.hasOwn(options, 'cause') && !('cause' in this)) {
|
---|
| 29 | const {
|
---|
| 30 | cause
|
---|
| 31 | } = options;
|
---|
| 32 | this.cause = cause;
|
---|
| 33 | if (cause instanceof Error && 'stack' in cause) {
|
---|
| 34 | this.stack = `${this.stack}\nCAUSE: ${cause.stack}`;
|
---|
| 35 | }
|
---|
| 36 | }
|
---|
| 37 | }
|
---|
| 38 | }
|
---|
| 39 | var _default = exports.default = ApiDOMError; |
---|
Note:
See
TracBrowser
for help on using the repository browser.