Gradle java custom plugin exception

I am developing custom gradle java plugin.In this I have my extension,plugin and task classes.In task class i am extending DefaultTask class and having task method with TaskAction annotation.I am able to successfully execute my plugin but in wrong case whenever exception is thrown my custom task class in that case gradle terminates program execution by displaying exception stacktrace on screen along with Build success message I want to change this exception stacktrace along with build Failure message.Could you please let me know how to do this I tried throwing stopActionException,TaskExectionException with no luck?could you please help guys?