(innerError, outerError)
| 169 | } |
| 170 | |
| 171 | const aggregateTwoErrors = (innerError, outerError) => { |
| 172 | if (innerError && outerError && innerError !== outerError) { |
| 173 | if (ArrayIsArray(outerError.errors)) { |
| 174 | // If `outerError` is already an `AggregateError`. |
| 175 | ArrayPrototypePush(outerError.errors, innerError); |
| 176 | return outerError; |
| 177 | } |
| 178 | let err; |
| 179 | if (isErrorStackTraceLimitWritable()) { |
| 180 | const limit = Error.stackTraceLimit; |
| 181 | Error.stackTraceLimit = 0; |
| 182 | // eslint-disable-next-line no-restricted-syntax |
| 183 | err = new AggregateError(new SafeArrayIterator([ |
| 184 | outerError, |
| 185 | innerError, |
| 186 | ]), outerError.message); |
| 187 | Error.stackTraceLimit = limit; |
| 188 | ErrorCaptureStackTrace(err, aggregateTwoErrors); |
| 189 | } else { |
| 190 | // eslint-disable-next-line no-restricted-syntax |
| 191 | err = new AggregateError(new SafeArrayIterator([ |
| 192 | outerError, |
| 193 | innerError, |
| 194 | ]), outerError.message); |
| 195 | } |
| 196 | err.code = outerError.code; |
| 197 | return err; |
| 198 | } |
| 199 | return innerError || outerError; |
| 200 | }; |
| 201 | |
| 202 | class NodeAggregateError extends AggregateError { |
| 203 | constructor(errors, message) { |
no test coverage detected
searching dependent graphs…