module.exports = function throwIfNonUnexpectedError(err) {
    if (err && err.message === 'aggregate error') {
        for (var i = 0 ; i < err.length ; i += 1) {
            throwIfNonUnexpectedError(err[i]);
        }
    } else if (!err || !err._isUnexpected) {
        throw err;
    }
};

module.exports = function throwIfNonUnexpectedError(err) {
    if (err && err.message === 'aggregate error') {
        for (var i = 0 ; i < err.length ; i += 1) {
            throwIfNonUnexpectedError(err[i]);
        }
    } else if (!err || !err._isUnexpected || err.errorMode === 'bubbleThrough') {
        throw err;
    }
};

Throw all Unexpected errors that have an errorMode of bubbleThrough.