Skip to content

Commit

Permalink
feat(AggregateError): add ability to skip wrap if inner already exists
Browse files Browse the repository at this point in the history
  • Loading branch information
EisenbergEffect committed Mar 26, 2015
1 parent 528e044 commit 98da4c3
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,15 @@
* @class AggregateError
* @constructor
*/
export function AggregateError(msg, inner) {
if (inner && inner.stack) {
msg += `\n------------------------------------------------\ninner error: ${inner.stack}`;
export function AggregateError(msg, inner, skipIfAlreadyAggregate) {
if(inner){
if(inner.innerError && skipIfAlreadyAggregate){
return inner;
}

if(inner.stack) {
msg += `\n------------------------------------------------\ninner error: ${inner.stack}`;
}
}

var err = new Error(msg);
Expand Down

0 comments on commit 98da4c3

Please sign in to comment.