Skip to content
This repository was archived by the owner on Feb 4, 2022. It is now read-only.

Commit 32a5e74

Browse files
committed
feat(error): all hasErrorLabel method to MongoError
This improves readability in the transactions code when branching on error labels for certain retry scenarios.
1 parent bd77d5d commit 32a5e74

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/error.js

+4
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ class MongoError extends Error {
4242
static create(options) {
4343
return new MongoError(options);
4444
}
45+
46+
hasErrorLabel(label) {
47+
return this.errorLabels && this.errorLabels.indexOf(label) !== -1;
48+
}
4549
}
4650

4751
/**

0 commit comments

Comments
 (0)