mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
util: add AggregateError.prototype.errors to inspect output
PR-URL: https://github.com/nodejs/node/pull/43646 Fixes: https://github.com/nodejs/node/issues/43645 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
This commit is contained in:
@@ -1352,6 +1352,12 @@ function formatError(err, constructor, tag, ctx, keys) {
|
||||
keys.push('cause');
|
||||
}
|
||||
|
||||
// Print errors aggregated into AggregateError
|
||||
if (ArrayIsArray(err.errors) &&
|
||||
(keys.length === 0 || !keys.includes('errors'))) {
|
||||
keys.push('errors');
|
||||
}
|
||||
|
||||
stack = improveStack(stack, constructor, name, tag);
|
||||
|
||||
// Ignore the error message if it's contained in the stack.
|
||||
|
||||
@@ -9,7 +9,29 @@ AggregateError: original
|
||||
at Module._load (node:internal/modules/cjs/loader:*:*)
|
||||
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:*:*)
|
||||
at node:internal/main/run_main_module:*:* {
|
||||
code: 'ERR0'
|
||||
code: 'ERR0',
|
||||
[errors]: [
|
||||
Error: original
|
||||
at Object.<anonymous> (*test*message*error_aggregateTwoErrors.js:*:*)
|
||||
at Module._compile (node:internal/modules/cjs/loader:*:*)
|
||||
at Module._extensions..js (node:internal/modules/cjs/loader:*:*)
|
||||
at Module.load (node:internal/modules/cjs/loader:*:*)
|
||||
at Module._load (node:internal/modules/cjs/loader:*:*)
|
||||
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:*:*)
|
||||
at node:internal/main/run_main_module:*:* {
|
||||
code: 'ERR0'
|
||||
},
|
||||
Error: second error
|
||||
at Object.<anonymous> (*test*message*error_aggregateTwoErrors.js:*:*)
|
||||
at Module._compile (node:internal/modules/cjs/loader:*:*)
|
||||
at Module._extensions..js (node:internal/modules/cjs/loader:*:*)
|
||||
at Module.load (node:internal/modules/cjs/loader:*:*)
|
||||
at Module._load (node:internal/modules/cjs/loader:*:*)
|
||||
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:*:*)
|
||||
at node:internal/main/run_main_module:*:* {
|
||||
code: 'ERR1'
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Node.js *
|
||||
|
||||
Reference in New Issue
Block a user