

(It may also send mail if this build succeeded but previous ones failed, and so on.) Even in that case, this step can be replaced by the following idiom: In the case of the mail sender, this means that it will send mail. Step([$class: 'Mailer', recipients: the shell step fails, the Pipeline build’s status will be set to failed, so that the subsequent mail step will see that this build is failed. It is also useful when using certain post-build actions (notifiers) originally defined for freestyle projects which pay attention to the result of the ongoing build. Otherwise, consider using plain try- catch(- finally) blocks. This step is most useful when used in Declarative Pipeline or with the options to set the stage result or ignore build interruptions.

The behavior of the step when an exception is thrown can be configured to print a message, set a build result other than failure, change the stage result, or ignore certain kinds of exceptions that are used to interrupt the build. If the body throws an exception, mark the build as a failure, but nonetheless continue to execute the Pipeline from the statement following the catchError step.

isUnix: Checks if running on a Unix-like node.fileExists: Verify if file exists in workspace.deleteDir: Recursively delete the current directory from the workspace.catchError: Catch error and set build result to failure.
