try {
... // Build steps
}
catch (java.lang.InterruptedException err) {
currentBuild.result = 'ABORTED' // Mark the build as aborted
}
catch (err) {
error err.message // Mark the build as failed
}
finally {
... // Clean up steps, build result reporting etc...
cleanWs(notFailBuild: true)
}
The only thing, is your build steps include nested try/catch blocks, you have to also catch the InterruptedException there and propagate it to this outer catch...
You can handle this:
try { InterruptedExce ption err) { result = 'ABORTED' // Mark the build as aborted notFailBuild: true)
... // Build steps
}
catch (java.lang.
currentBuild.
}
catch (err) {
error err.message // Mark the build as failed
}
finally {
... // Clean up steps, build result reporting etc...
cleanWs(
}
The only thing, is your build steps include nested try/catch blocks, you have to also catch the InterruptedExce ption there and propagate it to this outer catch...