next.js
bf07db07 - Show the errors of an AggregateError behind a cause (#97830)

Commit
49 days ago
Show the errors of an AggregateError behind a cause (#97830) A failed `fetch` hid the reason of the failure. Node.js reports every refused connection attempt in the `errors` of an `AggregateError`, and the terminal logged `[errors]: [ [Error], [Error] ]` without the address or the port of a single attempt. An `AggregateError` keeps its errors in an array. Node.js spends one level of the inspect depth on that array, and one more level on each error in the array, while a `cause` costs one level only. The errors of an `AggregateError` behind a cause therefore fell outside the default depth of two. Node.js also returns an error early when it carries no own properties, before it applies the depth, so the collapse hit only the errors that carry diagnostics. Next.js now adds the missing level back for an `AggregateError`, so its errors print at the same nesting as a cause. A depth of `null` means unlimited and stays unchanged, because `null + 1` would reduce it to one level.
Author
Parents
Loading