Skip to content

Commit 3b28aa6

Browse files
committed
add errors iterator to MultiErrorReply
1 parent 98cbdd0 commit 3b28aa6

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

packages/client/lib/client/index.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,7 @@ describe('Client', () => {
295295
assert.equal(err.replies.length, 2);
296296
assert.deepEqual(err.errorIndexes, [1]);
297297
assert.ok(err.replies[1] instanceof ErrorReply);
298+
assert.deepEqual([...err.errors()], [err.replies[1]]);
298299
return true;
299300
}
300301
);

packages/client/lib/errors.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,4 +79,10 @@ export class MultiErrorReply extends ErrorReply {
7979
this.replies = replies;
8080
this.errorIndexes = errorIndexes;
8181
}
82+
83+
*errors() {
84+
for (const index of this.errorIndexes) {
85+
yield this.replies[index];
86+
}
87+
}
8288
}

0 commit comments

Comments
 (0)