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 Summary
Modifier and TypeMethodDescriptionstatic Throwableapply(StepContext ctx, Throwable t) Looks up in the current context for aFailureHandlerand runs it against the givenThrowable.handle(StepContext ctx, Throwable t) Intercept the suppliedThrowable.static FailureHandlermerge(FailureHandler original, FailureHandler subsequent) Merge together twoFailureHandler.
-
Method Details
-
handle
Intercept the suppliedThrowable.- Parameters:
ctx- the context of the step being executedt- the originalThrowable- Returns:
- the new
Throwableto propagate
-
apply
Looks up in the current context for aFailureHandlerand runs it against the givenThrowable.- Parameters:
ctx- the context of the step being executedt- the originalThrowable- Returns:
- the new
Throwableto propagate
-
merge
static FailureHandler merge(@CheckForNull FailureHandler original, @NonNull FailureHandler subsequent) Merge together twoFailureHandler.- Parameters:
original- an original one, such as one already found in a contextsubsequent- what you are adding- Returns:
- a
FailureHandlerwhich runs them both in that sequence (or, as a convenience, justsubsequentin caseoriginalis null)
-