\begin{quote}
Create an error from multiple errors \end{quote}
\hypertarget{md_sfcode_node_modules_aggregate_error_readme_autotoc_md2604}{}\doxysection{Install}\label{md_sfcode_node_modules_aggregate_error_readme_autotoc_md2604}

\begin{DoxyCode}{0}
\DoxyCodeLine{\$ npm install aggregate-\/error }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_aggregate_error_readme_autotoc_md2605}{}\doxysection{Usage}\label{md_sfcode_node_modules_aggregate_error_readme_autotoc_md2605}

\begin{DoxyCode}{0}
\DoxyCodeLine{const AggregateError = require('aggregate-\/error');}
\DoxyCodeLine{}
\DoxyCodeLine{const error = new AggregateError([new Error('foo'), 'bar', \{message: 'baz'\}]);}
\DoxyCodeLine{}
\DoxyCodeLine{throw error;}
\DoxyCodeLine{/*}
\DoxyCodeLine{AggregateError:}
\DoxyCodeLine{    Error: foo}
\DoxyCodeLine{        at Object.<anonymous> (/Users/sindresorhus/dev/aggregate-\/error/example.js:3:33)}
\DoxyCodeLine{    Error: bar}
\DoxyCodeLine{        at Object.<anonymous> (/Users/sindresorhus/dev/aggregate-\/error/example.js:3:13)}
\DoxyCodeLine{    Error: baz}
\DoxyCodeLine{        at Object.<anonymous> (/Users/sindresorhus/dev/aggregate-\/error/example.js:3:13)}
\DoxyCodeLine{    at AggregateError (/Users/sindresorhus/dev/aggregate-\/error/index.js:19:3)}
\DoxyCodeLine{    at Object.<anonymous> (/Users/sindresorhus/dev/aggregate-\/error/example.js:3:13)}
\DoxyCodeLine{    at Module.\_compile (module.js:556:32)}
\DoxyCodeLine{    at Object.Module.\_extensions..js (module.js:565:10)}
\DoxyCodeLine{    at Module.load (module.js:473:32)}
\DoxyCodeLine{    at tryModuleLoad (module.js:432:12)}
\DoxyCodeLine{    at Function.Module.\_load (module.js:424:3)}
\DoxyCodeLine{    at Module.runMain (module.js:590:10)}
\DoxyCodeLine{    at run (bootstrap\_node.js:394:7)}
\DoxyCodeLine{    at startup (bootstrap\_node.js:149:9)}
\DoxyCodeLine{*/}
\DoxyCodeLine{}
\DoxyCodeLine{for (const individualError of error) \{}
\DoxyCodeLine{    console.log(individualError);}
\DoxyCodeLine{\}}
\DoxyCodeLine{//=> [Error: foo]}
\DoxyCodeLine{//=> [Error: bar]}
\DoxyCodeLine{//=> [Error: baz] }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_aggregate_error_readme_autotoc_md2606}{}\doxysection{API}\label{md_sfcode_node_modules_aggregate_error_readme_autotoc_md2606}
\hypertarget{md_sfcode_node_modules_aggregate_error_readme_autotoc_md2607}{}\doxysubsection{Aggregate\+Error(errors)}\label{md_sfcode_node_modules_aggregate_error_readme_autotoc_md2607}
Returns an {\ttfamily Error} that is also an \href{https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Iterators_and_Generators\#Iterables}{\texttt{ {\ttfamily Iterable}}} for the individual errors.\hypertarget{md_sfcode_node_modules_aggregate_error_readme_autotoc_md2608}{}\doxysubsubsection{errors}\label{md_sfcode_node_modules_aggregate_error_readme_autotoc_md2608}
Type\+: {\ttfamily Array$<$Error$\vert$\+Object$\vert$string$>$}

If a string, a new {\ttfamily Error} is created with the string as the error message.~\newline
 If a non-\/\+Error object, a new {\ttfamily Error} is created with all properties from the object copied over. 