[ajug-members] Groovy and Exceptions
Sony Antony
sony.antony at gmail.com
Wed Aug 22 17:49:34 EDT 2007
The way I understood it, all java calls with checked exceptions are
internally wrapped by Groovy to catch the exception.
This is then thrown as groovy runtime exceptions
Something like
try {
Call_java_method_that_might_throw_exception()
}
catch ( Exception e ) {
throw new RubyRuntimeExcetion ( e )
}
Maybe Im wrong in my understanding
--sony
On 8/22/07, Justin Fiore <justin.fiore at gmail.com> wrote:
> Hey All,
>
> After Jeff's great talk last night about Groovy, I decided to give it a
> whirl.
>
> Can anyone recall what he said about Groovy catching exceptions thrown from
> Java calls?
>
> I have my GUI in Groovy and app logic in Java.
>
> The app logic throws an Exception. I want to catch it in my GUI
> actionPerformed closure and then display it in a dialog.
>
> Something like this:
>
> button(text:'Refresh LAWN Login Status',
> actionPerformed: {
> try{
>
> lawnLoginXGUI.lawnLoginX.updateStatus()
> } catch(Exception e){
> JOptionPane.showMessageDialog(lawnLoginXGUI.mainFrame,
> e.getMessage(), "Status Update Attempt Error",
> JOptionPane.ERROR_MESSAGE)
> }
> })
>
> Where that button is part of a SwingBuilder.
>
> The exception thrown by .updateStatus() isn't being caught by the
> surrounding catch statement.
>
> Any ideas?
>
> --
> Justin Fiore
> justin.fiore at gmail.com
> _______________________________________________
> ajug-members mailing list
> ajug-members at ajug.org
> http://www.ajug.org/mailman/listinfo/ajug-members
>
>
More information about the ajug-members
mailing list