[CSHARP-689] Incorrect error message from ObjectId.Unpack() Created: 21/Feb/13  Updated: 20/Mar/14  Resolved: 25/Feb/13

Status: Closed
Project: C# Driver
Component/s: None
Affects Version/s: 1.7.1
Fix Version/s: 1.8

Type: Bug Priority: Trivial - P5
Reporter: Daniel Sinclair Assignee: Robert Stam
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Windows


Issue Links:
Related
related to CSHARP-474 Review all exceptions thrown by the C... Closed

 Description   

The new ArgumentOutOfRangeException() is incorrectly formed. It's passing a message as the parameter name. It should read;

throw new ArgumentOutOfRangeException("bytes", "Byte array must be 12 bytes long.");

Ideally though, it would have a bit more information relating to ObjectId.



 Comments   
Comment by auto [ 25/Feb/13 ]

Author:

{u'date': u'2013-02-22T15:59:26Z', u'name': u'rstam', u'email': u'robert@10gen.com'}

Message: CSHARP-689: Added missing paramName argument to calls to ArgumentOutOfRangeException.
Branch: master
https://github.com/mongodb/mongo-csharp-driver/commit/027eaf4b5278333d41175f8bab7cf5c2857fdbf0

Comment by Robert Stam [ 22/Feb/13 ]

A related question is whether ArgumentOutOfRangeException is the appropriate exception. In this particular case ArgumentException is probably more appropriate, because there is no numeric range involved.

We will be reviewing exceptions more thoroughly for 2.0. See CSHARP-474.

Generated at Wed Feb 07 21:37:33 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.