One of the aspects that I want to improve is error handling. Right now, I mostly just assume that everything is going to work and don't do much error handling; if the build fails, it fails.
This is really the Ant "way". Failure is a built-in mode of operation and handled appropriately already (I think).
However, I'd like to polish things to the point where, if any task (or at least target) fails for some reason, that a message specifying the nature of the problem is displayed and a specific error sound is played.
As for a message - you already get that. Is that not sufficient? If not, check out using the -logger or -listener command-line switch.
For sound, check out the <sound> task:
http://ant.apache.org/manual/OptionalTasks/sound.html
The problem is that the documentation on <fail> leaves a lot to the imagination.
<fail> is not really what you want to use given what you're asking for. Failure is built-in. A task fails, the build fails (generally speaking, that is). And the error message shown is descriptive enough to act upon.
I'm not at all clear on how I make my script branch to a <fail> task and then generate a message specific to the task which actually failed. A message that says "Your build failed" is a lot less useful to me than one that says "The second compile task of target ABC failed because you ran out of memory."
Add an <echo> at appropriate points (before each compile in this case) saying <echo>First compile...</echo> and <echo>Second compile...</echo>. You'd then see explicitly where things were. But, perhaps it'd be better to have your two compiles in separate targets, making it explicitly clear which one failed.
As for running out of memory - don't you see that stated pretty clearly with the exception thrown?
Erik
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]