Class FlowInterruptedException

java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.InterruptedException
org.jenkinsci.plugins.workflow.steps.FlowInterruptedException
All Implemented Interfaces:
Serializable

public final class FlowInterruptedException extends InterruptedException
Special exception that can be thrown out of FutureCallback.onFailure(java.lang.Throwable) to indicate that the flow was aborted from the inside. (This could be caught like any other exception and rethrown or ignored. It only takes effect if thrown all the way up. Consumers, such as steps, may find isActualInterruption() useful in deciding whether to ignore or rethrow the exception.)

No stack trace is printed (except by Throwable.getCause() and/or Throwable.getSuppressed() if present), and you can control the Result and CauseOfInterruption.

Analogous to Executor.interrupt(Result, CauseOfInterruption...) but does not assume we are running inside an executor thread.

There is no need to call this from StepExecution.stop(java.lang.Throwable) since in that case the execution owner should have set a CauseOfInterruption.UserInterruption and Result.ABORTED.

See Also:
  • Constructor Details

  • Method Details

    • getResult

      @NonNull public Result getResult()
    • getCauses

      @NonNull public List<CauseOfInterruption> getCauses()
    • isActualInterruption

      public boolean isActualInterruption()
    • setActualInterruption

      public void setActualInterruption(boolean actualInterruption)
    • handle

      public void handle(Run<?,?> run, TaskListener listener)
      If a build catches this exception, it should use this method to report it.