org.gradle.api.tasks
Class StopActionException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by java.lang.RuntimeException
              extended by org.gradle.api.GradleException
                  extended by org.gradle.api.tasks.StopActionException
All Implemented Interfaces:
Serializable

public class StopActionException
extends GradleException

A StopActionException is be thrown by a task Action or task action closure to stop its own execution and to start execution of the task's next action. An action can usually be stopped by just calling return inside the action closure. But if the action works with helper methods that can lead to redundant code. For example:

     List existentSourceDirs = HelperUtil.getExistentSourceDirs()
     if (!existentSourceDirs) {return}
 

If the getExistentSourceDirs() throws a StopActionException instead, the tasks does not need the if statement.

Note that throwing this exception does not fail the execution of the task or the build.

See Also:
Serialized Form

Constructor Summary
StopActionException()
           
StopActionException(String message)
           
 
Method Summary
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StopActionException

public StopActionException()

StopActionException

public StopActionException(String message)