0
0
Jenkinsdevops~10 mins

Try-catch-finally in pipelines in Jenkins - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to start a try block in a Jenkins pipeline script.

Jenkins
try [1]
Drag options to blanks, or click blank then click option'
A[
B{
C<
D(
Attempts:
3 left
💡 Hint
Common Mistakes
Using parentheses instead of curly braces.
Using square brackets or angle brackets.
2fill in blank
medium

Complete the code to catch an exception named 'err' in a Jenkins pipeline.

Jenkins
catch ([1]) {
Drag options to blanks, or click blank then click option'
Ae
Berror
Cexception
Derr
Attempts:
3 left
💡 Hint
Common Mistakes
Using a different variable name than declared.
Omitting the parentheses.
3fill in blank
hard

Fix the error in the finally block syntax in this Jenkins pipeline snippet.

Jenkins
finally [1]
Drag options to blanks, or click blank then click option'
A(
B[
C{
D;
Attempts:
3 left
💡 Hint
Common Mistakes
Using parentheses or brackets instead of curly braces.
Adding a semicolon after finally.
4fill in blank
hard

Complete the code to complete the try-catch structure in a Jenkins pipeline.

Jenkins
try {
    // code
} catch ({BLANK_2}}) {
Drag options to blanks, or click blank then click option'
A{
Berr
Cerror
D(
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong symbols to open blocks.
Using incorrect variable names in catch.
5fill in blank
hard

Complete the code to complete a try-catch block in a Jenkins pipeline.

Jenkins
try {
    echo 'Running try block'
} catch ([1]) {
    echo "Caught: ${err}"
}
Drag options to blanks, or click blank then click option'
A{
Berr
D(
Attempts:
3 left
💡 Hint
Common Mistakes
Using parentheses instead of curly braces for blocks.
Using wrong variable names in catch.