Build result in scripted pipeline

Hi All,

I have pipeline, defined in SCM.
I am trying to perform some actions in case the build failed.
To perform it I added try-catch-finally block. In the catch block I mark the currentBuild.result as “FAILURE”, and in the Finally, I check the currentBuild.result and perform my actions.
The pipeline contains some downstream jobs. when one of the sub job is aborted, exception is thrown and the build marked as FAILURE.
I don’t want the actions of failures to invoked in this case. what can I do?


I found a way:
use the filed result in org.jenkinsci.plugins.workflow.steps.FlowInterruptedException.
like this:

catch (exception) {
if (exception instanceof org.jenkinsci.plugins.workflow.steps.FlowInterruptedException){
currentBuild.result = exception.result