Browse files

Updated changelog

Added better error handling
  • Loading branch information...
1 parent a7027ef commit 9d4dcb134939a1383f9168cf02c4c4888ef0782d @poiati committed Sep 12, 2010
View
2 CHANGELOG.txt
@@ -1,6 +1,8 @@
* 0.6
- Collections truth. Empty collections are evaluated to false and non empty are evaluated to true in logical expression
- Better internal error handling
+ - Changed mongo-java-driver to version 2.1
+ - Changed Groovy version to 1.7.4
* 0.5 Nightly
- Improved error handling in com.mongodb.DB#inRequest (now this method calls com.mongodb.DB#requestDone even if the closure throws an exception)
View
12 src/main/groovy/com/gmongo/internal/Patcher.groovy
@@ -32,12 +32,12 @@ class Patcher {
def method = o.class.metaClass.getMetaMethod(nameOrAlias, _types(cargs, true))
if (method == null) {
def other = addmethods[nameOrAlias]
- if (other != null) {
- other.delegate = o
- def largs = []
- for (arg in cargs) largs << arg
- return other.call(largs)
- }
+ if (other == null)
+ throw new MissingMethodException(name, o.class, args)
+ other.delegate = o
+ def largs = []
+ for (arg in cargs) largs << arg
+ return other.call(largs)
}
def result = method.doMethodInvoke(delegate, cargs)
afterreturn.get(nameOrAlias)?.call(args, result)
View
15 src/test/groovy/com/gmongo/DBCollectionTest.groovy
@@ -321,16 +321,23 @@ class DBCollectionTest extends IntegrationTestCase {
}
void testMissingMethod() {
+
def msg = shouldFail(MissingMethodException) {
- db.foo()
+ db.fooBar.blabla([baz: "foo"])
}
def msg2 = shouldFail(MissingMethodException) {
- db.fooBar([:])
+ db.fooBar.bla("foo")
+ }
+
+ def msg3 = shouldFail(MissingMethodException) {
+ db.fooBar.insert("bar")
}
- assert msg.contains("foo")
- assert msg2.contains("fooBar")
+ assert msg.contains("blabla")
+ assert msg2.contains("bla")
+ assert msg3.contains("insert")
+ assert msg3.contains("String")
}
void testGetDB() {

0 comments on commit 9d4dcb1

Please sign in to comment.