Skip to content

Commit

Permalink
Merge pull request #1119 from schuetzm/bsonobjectid-convexception
Browse files Browse the repository at this point in the history
Throw more appropriate std.conv.ConvException in BsonObjectID.fromHex…
  • Loading branch information
s-ludwig committed May 26, 2015
2 parents 9294786 + 1f3ea37 commit 4070d06
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions source/vibe/data/bson.d
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ struct Bson {
entries ~= Bson(1);
entries ~= Bson(true);
entries ~= Bson("foo");

Bson value = Bson(entries);
assert(value[0] == Bson(1));
assert(value[1] == Bson(true));
Expand Down Expand Up @@ -730,8 +730,9 @@ struct BsonObjectID {
*/
static BsonObjectID fromString(string str)
{
static const lengthex = new Exception("BSON Object ID string must be 24 characters.");
static const charex = new Exception("Not a valid hex string.");
import std.conv : ConvException;
static const lengthex = new ConvException("BSON Object ID string must be 24 characters.");
static const charex = new ConvException("Not a valid hex string.");

if (str.length != 24) throw lengthex;
BsonObjectID ret = void;
Expand Down

0 comments on commit 4070d06

Please sign in to comment.