exception handling Take 2

This commit is contained in:
Dominik Chilla 2020-07-11 23:44:00 +02:00
parent 9db0035eaa
commit 3f9337752f

5
Jenkinsfile vendored
View File

@ -7,6 +7,7 @@ pipeline {
stage('Approve'){ stage('Approve'){
steps { steps {
script { script {
import org.jenkinsci.plugins.workflow.steps.FlowInterruptedException
def userInput def userInput
try { try {
timeout(time: 5, unit: 'SECONDS') { timeout(time: 5, unit: 'SECONDS') {
@ -17,10 +18,10 @@ pipeline {
name: 'Please confirm you agree with this' name: 'Please confirm you agree with this'
]]) ]])
} }
} catch(FlowInterruptedException) { } catch(FlowInterruptedException e) {
echo "This job timed out" echo "This job timed out"
} catch(err) { // input false } catch(err) { // input false
echo "This Job has been Aborted" echo "This job has been aborted"
} }
if (userInput == true) { if (userInput == true) {
// do something // do something