try {
throw new AggregateError(
// An iterable of errors
new Set([new Error("some error"), new Error("another error")]),
"Multiple errors thrown",
);
} catch (err) {
console.log(err.errors);
// [
// Error: some error,
// Error: another error
// ]
}AggregateError: errors / notebook
AggregateError: errors
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.