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

Commit

Permalink
feat(error): all hasErrorLabel method to MongoError
Browse files Browse the repository at this point in the history
This improves readability in the transactions code when branching
on error labels for certain retry scenarios.
  • Loading branch information
mbroadst committed Feb 4, 2019
1 parent bd77d5d commit 32a5e74
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/error.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ class MongoError extends Error {
static create(options) {
return new MongoError(options);
}

hasErrorLabel(label) {
return this.errorLabels && this.errorLabels.indexOf(label) !== -1;
}
}

/**
Expand Down

0 comments on commit 32a5e74

Please sign in to comment.