mirror of
https://github.com/nodejs/node.git
synced 2026-11-27 17:52:27 -05: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:
1 parent
0167988ce3
commit
5edfccfc4c
2 files changed
+29
-1
No files matched your search
@@ -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,5 +9,27 @@ AggregateError: original
|
||||
at Function.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 Object.Module._extensions..js (node:internal/modules/cjs/loader:*:*)
|
||||
at Module.load (node:internal/modules/cjs/loader:*:*)
|
||||
at Function.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 Object.Module._extensions..js (node:internal/modules/cjs/loader:*:*)
|
||||
at Module.load (node:internal/modules/cjs/loader:*:*)
|
||||
at Function.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'
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in new issue
Block a user