Interface FailureHandler

All Superinterfaces:
Serializable
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface @Restricted(org.kohsuke.accmod.restrictions.Beta.class) public interface FailureHandler extends Serializable
Interface destined for StepContext.get(java.lang.Class<T>) to rewrite or wrap Throwables. Pass into BodyInvoker.withContext(java.lang.Object).
  • Method Details

    • handle

      @NonNull Throwable handle(@NonNull StepContext ctx, @NonNull Throwable t)
      Intercept the supplied Throwable.
      Parameters:
      ctx - the context of the step being executed
      t - the original Throwable
      Returns:
      the new Throwable to propagate
    • apply

      @NonNull static Throwable apply(@NonNull StepContext ctx, @NonNull Throwable t)
      Looks up in the current context for a FailureHandler and runs it against the given Throwable.
      Parameters:
      ctx - the context of the step being executed
      t - the original Throwable
      Returns:
      the new Throwable to propagate
    • merge

      static FailureHandler merge(@CheckForNull FailureHandler original, @NonNull FailureHandler subsequent)
      Merge together two FailureHandler.
      Parameters:
      original - an original one, such as one already found in a context
      subsequent - what you are adding
      Returns:
      a FailureHandler which runs them both in that sequence (or, as a convenience, just subsequent in case original is null)