exception handling take 4

This commit is contained in:
Dominik Chilla 2020-07-11 23:58:20 +02:00
parent 9941894a4f
commit 74d6924cf6

26
Jenkinsfile vendored
View File

@ -8,19 +8,21 @@ pipeline {
steps { steps {
script { script {
def userInput def userInput
try { catchError(buildResult: 'SUCCESS', stageResult: 'ABORTED') {
timeout(time: 5, unit: 'SECONDS') { try {
userInput = input(id: 'Proceed1', message: 'Was this successful?', parameters: [[ timeout(time: 15, unit: 'SECONDS') {
$class: 'BooleanParameterDefinition', userInput = input(id: 'Proceed1', message: 'Was this successful?', parameters: [[
defaultValue: true, $class: 'BooleanParameterDefinition',
description: '', defaultValue: true,
name: 'Please confirm you agree with this' description: '',
]]) name: 'Please confirm you agree with this'
]])
}
} catch(org.jenkinsci.plugins.workflow.steps.FlowInterruptedException e) {
error "Caught ${e.toString()}"
} catch(err) { // input false
echo "This job has been aborted"
} }
} catch(org.jenkinsci.plugins.workflow.steps.FlowInterruptedExceptionedException e) {
echo "This job timed out"
} catch(err) { // input false
echo "This job has been aborted"
} }
if (userInput == true) { if (userInput == true) {
// do something // do something