Skip to content
This repository has been archived by the owner on Jan 21, 2022. It is now read-only.

Commit

Permalink
Incorrect casting of getAs and family should throw an Exception, not a
Browse files Browse the repository at this point in the history
warning.  Catch if you don't like it.
  • Loading branch information
Brendan W. McAdams committed Jun 23, 2012
1 parent 529a555 commit 0408311
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion casbah-commons/src/main/scala/MongoDBObject.scala
Expand Up @@ -116,7 +116,7 @@ class MongoDBObject(val underlying: DBObject = new BasicDBObject) extends Map[St
case value if manifest[A] >:> Manifest.classType(value.getClass) =>
Some(value.asInstanceOf[A])
case fail =>
log.warn("Unable to cast '%s' as '%s'; please check your types.", Manifest.classType(fail.getClass), manifest[A])
throw new IllegalArgumentException("Unable to cast '%s' as '%s'; please check your types.".format(Manifest.classType(fail.getClass), manifest[A]))
None
}
}
Expand Down

0 comments on commit 0408311

Please sign in to comment.