ant-dev mailing list archives

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

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

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

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 ?

Thoughts?

-- 
Cheers,

Pete

*-----------------------------------------------------*
| 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:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message