source: node_modules/@swagger-api/apidom-error/cjs/ApiDOMAggregateError.cjs

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.2 KB
Line 
1"use strict";
2
3var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault").default;
4exports.__esModule = true;
5exports.default = void 0;
6var _aggregateError = _interopRequireDefault(require("@babel/runtime-corejs3/core-js/aggregate-error"));
7class ApiDOMAggregateError extends _aggregateError.default {
8 constructor(errors, message, options) {
9 super(errors, message, options);
10 this.name = this.constructor.name;
11 if (typeof message === 'string') {
12 this.message = message;
13 }
14 if (typeof Error.captureStackTrace === 'function') {
15 Error.captureStackTrace(this, this.constructor);
16 } else {
17 this.stack = new Error(message).stack;
18 }
19
20 /**
21 * This needs to stay here until our minimum supported version of Node.js is >= 16.9.0.
22 * Node.js >= 16.9.0 supports error causes natively.
23 */
24 if (options != null && typeof options === 'object' && Object.hasOwn(options, 'cause') && !('cause' in this)) {
25 const {
26 cause
27 } = options;
28 this.cause = cause;
29 if (cause instanceof Error && 'stack' in cause) {
30 this.stack = `${this.stack}\nCAUSE: ${cause.stack}`;
31 }
32 }
33 }
34}
35var _default = exports.default = ApiDOMAggregateError;
Note: See TracBrowser for help on using the repository browser.