ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jose Alberto Fernandez" <j_a_fernan...@yahoo.com>
Subject Re: TryCatchFinallyTask ?
Date Sun, 10 Feb 2002 15:01:45 GMT
From: "Peter Donald" <peter@apache.org>

> 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 ...
> 

I like it, in principle. In particular because I think it is better than adding failonerror
attributes
all over the place. I would suggest a couple of things:

1) Add a way to actually catch the exception being thrown and to rethrow it, something like:

    <catch id="myError" >
        <!-- do some cleaning here -->
        <fail refid="myError" />
    </catch>

2) I would add to <echo> the capability to print the message and allow me to continue
the processing.

    <catch id="myError" >
        <!-- do some cleaning here -->
        <echo refid="myError" />
        <!-- continue processing -->
    </catch>

Jose Alberto



--
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