exception handling take 4
This commit is contained in:
parent
9941894a4f
commit
74d6924cf6
8
Jenkinsfile
vendored
8
Jenkinsfile
vendored
@ -8,8 +8,9 @@ pipeline {
|
||||
steps {
|
||||
script {
|
||||
def userInput
|
||||
catchError(buildResult: 'SUCCESS', stageResult: 'ABORTED') {
|
||||
try {
|
||||
timeout(time: 5, unit: 'SECONDS') {
|
||||
timeout(time: 15, unit: 'SECONDS') {
|
||||
userInput = input(id: 'Proceed1', message: 'Was this successful?', parameters: [[
|
||||
$class: 'BooleanParameterDefinition',
|
||||
defaultValue: true,
|
||||
@ -17,11 +18,12 @@ pipeline {
|
||||
name: 'Please confirm you agree with this'
|
||||
]])
|
||||
}
|
||||
} catch(org.jenkinsci.plugins.workflow.steps.FlowInterruptedExceptionedException e) {
|
||||
echo "This job timed out"
|
||||
} catch(org.jenkinsci.plugins.workflow.steps.FlowInterruptedException e) {
|
||||
error "Caught ${e.toString()}"
|
||||
} catch(err) { // input false
|
||||
echo "This job has been aborted"
|
||||
}
|
||||
}
|
||||
if (userInput == true) {
|
||||
// do something
|
||||
echo "this was successful"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user