AnbuMani, welcome to
Java Ranch!
Once an Ant task fails, by default Ant stops running, so there is no way that another task could check the build status and do something.
Ant does return 0 if the build succeeded and a non-zero value if it failed, so you could check for that within a script.