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 Throwable
s.
Pass into BodyInvoker.withContext(java.lang.Object)
.-
Method Summary
Modifier and TypeMethodDescriptionstatic Throwable
apply
(StepContext ctx, Throwable t) Looks up in the current context for aFailureHandler
and runs it against the givenThrowable
.handle
(StepContext ctx, Throwable t) Intercept the suppliedThrowable
.static FailureHandler
merge
(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
Throwable
to propagate
-
apply
Looks up in the current context for aFailureHandler
and runs it against the givenThrowable
.- Parameters:
ctx
- the context of the step being executedt
- the originalThrowable
- Returns:
- the new
Throwable
to 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
FailureHandler
which runs them both in that sequence (or, as a convenience, justsubsequent
in caseoriginal
is null)
-