Skip to content

Commit

Permalink
Raise exception on errors, including at runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmelnikow committed Aug 14, 2013
1 parent 8ef4ec7 commit e2624d4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Mongo/MongoDBCollection.m
Expand Up @@ -266,8 +266,8 @@ - (NSArray *) allIndexesWithError:(NSError * __autoreleasing *) error {
}

- (BOOL) ensureIndex:(MongoMutableIndex *) index error:(NSError * __autoreleasing *) error {
NSParameterAssert(index != nil);
NSParameterAssert(index.fields.allKeys.count > 0);
if (!index) [NSException raise:NSInvalidArgumentException format:@"Nil parameter"];
if (!index.fields.allKeys.count) [NSException raise:NSInvalidArgumentException format:@"No fields in index"];
bson *tempBson = bson_alloc();
int result = mongo_create_index(self.connection.connValue,
self.fullyQualifiedName.bsonString,
Expand Down

0 comments on commit e2624d4

Please sign in to comment.