Class CatchErrorStep
java.lang.Object
hudson.model.AbstractDescribableImpl<org.jenkinsci.plugins.workflow.steps.Step>
org.jenkinsci.plugins.workflow.steps.Step
org.jenkinsci.plugins.workflow.steps.CatchErrorStep
- All Implemented Interfaces:
ExtensionPoint,Describable<org.jenkinsci.plugins.workflow.steps.Step>,Serializable,CatchExecutionOptions
public final class CatchErrorStep
extends org.jenkinsci.plugins.workflow.steps.Step
implements CatchExecutionOptions
Runs a block.
By default, if that block fails, marks the build as failed, but continues execution. Can be customized to print a
message when the block fails, to set a different build result, to annotate the step with
WarningAction for
advanced visualizations, or to rethrow FlowInterruptedException rather than continuing execution.- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classstatic final classNested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionThe result that will be used for setting the build result if an error is caught.A message to be printed when an error is caught.The result that will be used for annotating the withWarningAction) if an error is caught.booleanWhetherFlowInterruptedExceptionshould be caught and handled by the step or rethrown.voidsetBuildResult(String buildResult) voidsetCatchInterruptions(boolean catchInterruptions) voidsetMessage(String message) voidsetStageResult(String stageResult) org.jenkinsci.plugins.workflow.steps.StepExecutionstart(org.jenkinsci.plugins.workflow.steps.StepContext context) Methods inherited from class org.jenkinsci.plugins.workflow.steps.Step
getDescriptor
-
Constructor Details
-
CatchErrorStep
@DataBoundConstructor public CatchErrorStep()
-
-
Method Details
-
getMessage
Description copied from interface:CatchExecutionOptionsA message to be printed when an error is caught. IfCatchExecutionOptions.getStepResultOnError()(by adding aWarningAction)- Specified by:
getMessagein interfaceCatchExecutionOptions
-
setMessage
-
getBuildResultOnError
Description copied from interface:CatchExecutionOptionsThe result that will be used for setting the build result if an error is caught. ReturnResult.SUCCESSto leave the build result unchanged. IfCatchExecutionOptions.isCatchInterruptions()returnstrue, then if aFlowInterruptedExceptionis caught, its result will be used instead of this value.- Specified by:
getBuildResultOnErrorin interfaceCatchExecutionOptions
-
getBuildResult
-
setBuildResult
-
getStepResultOnError
Description copied from interface:CatchExecutionOptionsThe result that will be used for annotating the withWarningAction) if an error is caught. ReturnResult.SUCCESSto leave the step result unchanged. IfCatchExecutionOptions.isCatchInterruptions()returnstrue, then if aFlowInterruptedExceptionis caught, its result will be used instead of this value.- Specified by:
getStepResultOnErrorin interfaceCatchExecutionOptions
-
getStageResult
-
setStageResult
-
isCatchInterruptions
public boolean isCatchInterruptions()Description copied from interface:CatchExecutionOptionsWhetherFlowInterruptedExceptionshould be caught and handled by the step or rethrown.FlowInterruptedExceptionis commonly used to control the flow of execution for things like builds aborted by a user and builds that time out inside ofTimeoutStep. It is sometimes desirable to rethrow these kinds of exceptions rather than catching them so as to not interfere with their intended behavior.- Specified by:
isCatchInterruptionsin interfaceCatchExecutionOptions
-
setCatchInterruptions
@DataBoundSetter public void setCatchInterruptions(boolean catchInterruptions) -
start
public org.jenkinsci.plugins.workflow.steps.StepExecution start(org.jenkinsci.plugins.workflow.steps.StepContext context) throws Exception - Specified by:
startin classorg.jenkinsci.plugins.workflow.steps.Step- Throws:
Exception
-