You've already forked node-redis
mirror of
https://github.com/redis/node-redis.git
synced 2025-08-07 13:22:56 +03:00
add errors iterator to MultiErrorReply
This commit is contained in:
@@ -295,6 +295,7 @@ describe('Client', () => {
|
||||
assert.equal(err.replies.length, 2);
|
||||
assert.deepEqual(err.errorIndexes, [1]);
|
||||
assert.ok(err.replies[1] instanceof ErrorReply);
|
||||
assert.deepEqual([...err.errors()], [err.replies[1]]);
|
||||
return true;
|
||||
}
|
||||
);
|
||||
|
@@ -79,4 +79,10 @@ export class MultiErrorReply extends ErrorReply {
|
||||
this.replies = replies;
|
||||
this.errorIndexes = errorIndexes;
|
||||
}
|
||||
|
||||
*errors() {
|
||||
for (const index of this.errorIndexes) {
|
||||
yield this.replies[index];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user