MCPcopy Index your code
hub / github.com/nodejs/node / aggregateTwoErrors

Function aggregateTwoErrors

lib/internal/errors.js:171–200  ·  view source on GitHub ↗
(innerError, outerError)

Source from the content-addressed store, hash-verified

169}
170
171const 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
202class NodeAggregateError extends AggregateError {
203 constructor(errors, message) {

Callers 13

truncateFunction · 0.85
lchmodFunction · 0.85
writeAllFunction · 0.85
destroyFunction · 0.85
fromFunction · 0.85
createAsyncIteratorFunction · 0.85
pumpToNodeFunction · 0.85
doneMethod · 0.85
handleFdCloseFunction · 0.85
readFileAfterCloseFunction · 0.85

Calls 1

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…