source: node_modules/@swagger-api/apidom-error/es/ApiDOMAggregateError.mjs@ d24f17c

main
Last change on this file since d24f17c was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago

Initial commit

  • Property mode set to 100644
File size: 1.0 KB
Line 
1import _AggregateError from "@babel/runtime-corejs3/core-js/aggregate-error";
2class ApiDOMAggregateError extends _AggregateError {
3 constructor(errors, message, options) {
4 super(errors, message, options);
5 this.name = this.constructor.name;
6 if (typeof message === 'string') {
7 this.message = message;
8 }
9 if (typeof Error.captureStackTrace === 'function') {
10 Error.captureStackTrace(this, this.constructor);
11 } else {
12 this.stack = new Error(message).stack;
13 }
14
15 /**
16 * This needs to stay here until our minimum supported version of Node.js is >= 16.9.0.
17 * Node.js >= 16.9.0 supports error causes natively.
18 */
19 if (options != null && typeof options === 'object' && Object.hasOwn(options, 'cause') && !('cause' in this)) {
20 const {
21 cause
22 } = options;
23 this.cause = cause;
24 if (cause instanceof Error && 'stack' in cause) {
25 this.stack = `${this.stack}\nCAUSE: ${cause.stack}`;
26 }
27 }
28 }
29}
30export default ApiDOMAggregateError;
Note: See TracBrowser for help on using the repository browser.