Skip to content

Commit 027eaf4

Browse files
author
rstam
committed
CSHARP-689: Added missing paramName argument to calls to ArgumentOutOfRangeException.
1 parent b943820 commit 027eaf4

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

MongoDB.Bson/ObjectModel/BsonDocument.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ public virtual BsonDocument Add(IDictionary dictionary, IEnumerable keys)
547547
{
548548
if (key.GetType() != typeof(string))
549549
{
550-
throw new ArgumentOutOfRangeException("A key passed to BsonDocument.Add is not a string.");
550+
throw new ArgumentOutOfRangeException("keys", "A key passed to BsonDocument.Add is not a string.");
551551
}
552552
Add((string)key, BsonTypeMapper.MapToBsonValue(dictionary[key]));
553553
}
@@ -639,7 +639,7 @@ public virtual BsonDocument AddRange(IDictionary dictionary)
639639
{
640640
if (entry.Key.GetType() != typeof(string))
641641
{
642-
throw new ArgumentOutOfRangeException("One or more keys in the dictionary passed to BsonDocument.AddRange is not a string.");
642+
throw new ArgumentOutOfRangeException("dictionary", "One or more keys in the dictionary passed to BsonDocument.AddRange is not a string.");
643643
}
644644
Add((string)entry.Key, BsonTypeMapper.MapToBsonValue(entry.Value));
645645
}

MongoDB.Bson/ObjectModel/BsonTypeMapper.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ public static object MapToDotNetValue(BsonValue bsonValue, BsonTypeMapperOptions
338338
break;
339339
case DuplicateNameHandling.ThrowException:
340340
var message = string.Format("Duplicate element name '{0}'.", element.Name);
341-
throw new ArgumentOutOfRangeException(message);
341+
throw new ArgumentOutOfRangeException("bsonValue", message);
342342
}
343343
}
344344
else
@@ -366,7 +366,7 @@ public static object MapToDotNetValue(BsonValue bsonValue, BsonTypeMapperOptions
366366
break;
367367
case DuplicateNameHandling.ThrowException:
368368
var message = string.Format("Duplicate element name '{0}'.", element.Name);
369-
throw new ArgumentOutOfRangeException(message);
369+
throw new ArgumentOutOfRangeException("bsonValue", message);
370370
}
371371
}
372372
else

MongoDB.Bson/ObjectModel/ObjectId.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ public static void Unpack(byte[] bytes, out int timestamp, out int machine, out
368368
}
369369
if (bytes.Length != 12)
370370
{
371-
throw new ArgumentOutOfRangeException("Byte array must be 12 bytes long.");
371+
throw new ArgumentOutOfRangeException("bytes", "Byte array must be 12 bytes long.");
372372
}
373373
timestamp = (bytes[0] << 24) + (bytes[1] << 16) + (bytes[2] << 8) + bytes[3];
374374
machine = (bytes[4] << 16) + (bytes[5] << 8) + bytes[6];

MongoDB.Bson/Serialization/IdGenerators/BsonBinaryDataGuidGenerator.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ public bool IsEmpty(object id)
132132
var subType = idBsonBinaryData.SubType;
133133
if (subType != BsonBinarySubType.UuidLegacy && subType != BsonBinarySubType.UuidStandard)
134134
{
135-
throw new ArgumentOutOfRangeException("The binary sub type of the id value passed to the BsonBinaryDataGuidGenerator IsEmpty method is not UuidLegacy or UuidStandard.");
135+
throw new ArgumentOutOfRangeException("id", "The binary sub type of the id value passed to the BsonBinaryDataGuidGenerator IsEmpty method is not UuidLegacy or UuidStandard.");
136136
}
137137
return idBsonBinaryData.Bytes.SequenceEqual(__emptyGuidBytes);
138138
}

0 commit comments

Comments
 (0)