4 Sep 12:18
[groovy-user] Throwing exception when closure parameter is not given
From: Setya <jsetya@...>
Subject: [groovy-user] Throwing exception when closure parameter is not given
Newsgroups: gmane.comp.lang.groovy.user
Date: 2008-09-04 10:19:56 GMT
Subject: [groovy-user] Throwing exception when closure parameter is not given
Newsgroups: gmane.comp.lang.groovy.user
Date: 2008-09-04 10:19:56 GMT
Hi all,
I'm attaching dynamic method to an Expando here:
def Expando exp = new Expando();
exp.bind
{ fieldName ->
if (!fieldName || fieldName.trim() == '')
throw new Exception('Field name is required.');
}
The above snippet works well if I call the method with syntax "bind
'fieldname'" or "bind()", but if I call it using only "bind" no exception
was thrown.
Any ideas ?
Setya
--
--
View this message in context: http://www.nabble.com/Throwing-exception-when-closure-parameter-is-not-given-tp19307480p19307480.html
Sent from the groovy - user mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email
(Continue reading)
RSS Feed