Skip to content

Commit

Permalink
Use correct error code for ignoring error with mongo index not existi…
Browse files Browse the repository at this point in the history
…ng. Fixes scobal#405.
  • Loading branch information
rehevkor5 committed Mar 26, 2017
1 parent 85d966f commit 74817bb
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions seyren-mongo/src/main/java/com/seyren/mongo/MongoStore.java
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,9 @@ private void removeOldIndices() {
try {
getAlertsCollection().dropIndex(new BasicDBObject("checkId", 1).append("target", 1));
} catch (MongoCommandException e) {
if (e.getCode() != 27) {
// 27 is the code which appears when the index doesn't exist (which we're happy with, anything else is bad news)
if (e.getCode() != 27 && e.getCode() != -1) {
// -1 is the code which appears when the index doesn't exist (which we're happy with, anything else is
// bad news)
throw e;
}
}
Expand Down

0 comments on commit 74817bb

Please sign in to comment.