ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Donald <>
Subject TryCatchFinallyTask ?
Date Sun, 10 Feb 2002 09:25:54 GMT

I can't recall if this has been rejected before but I going to propose it 
again ;)

Error handling in ant sucks - I have come across two today places where I 
have really wanted better handling of that sort of thing. Sometimes tasks 
throw errors that you want to respond to (ie send a mail) others throw errors 
you can ignore (ie maudit) and in many cases you want to cleanup after you 
regardless fo success or not (delete that null.tmp!).

Anyways I prototyped something like this for ant2 and while it hasn't been 
tested in all the places I wanted to use it - I did really like it in the few 
places I have tested it. Basically you have as task container that looks like 
the following. it also behaves in exactly the same way that java languaghe 
try-catch-finally constructs work.

It would look like

    <echo message="About to fail"/>
    <fail message="Failing!"/>
    <echo message="the task failed but we are ignoring it"/>
    <echo message="Cleaning up after myself ..."/>

And would result in something like

About to fail
the task failed but we are ignoring it
Cleaning up after myself ...

The term <tbody/> sucks and I have tried to think of a nice name for it. I 
tried a few - I believe I committed seomething like "try-catch" into myrmidon 
but maybe a better name for task would be <tryCatchFinally/> or something ?




| For those who refuse to understand, no explanation  |
| will ever suffice. For those who refuse to believe, |
| no evidence will ever suffice.                      |

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message