title: Try-catch block in Jenkins pipeline script
body: <p>I'm trying to use the following code to execute builds, and in the end, execute post build actions when builds were successful. Still, I get a MultipleCompilationErrorsException, saying that my try block is Not a valid section definition. Please help, I tried a lot reorganize the block but can't seem to be able to solve the issue.</p>
  <pre><code>pipeline{
  
  agent any 
      try {
          stages{
              stage(&quot;Parallel 1&quot;) {
                  steps {
                      parallel (
                         'firstTask' : { 
                              build( &quot;DSL-Controll-Demo-Fibonacci-1&quot; )
                          },
                          'secondTask' : { 
                              build( &quot;DSL-Controll-Demo-Fibonacci-2&quot; )
                          }
                      )
                  }
              }
              stage(&quot;Feature&quot;) {
                  steps {
                          build( &quot;DSL-Controll-Demo-Fibonacci-5&quot; )
                          build( &quot;DSL-Controll-Demo-Fibonacci-6&quot; )
                  }
              }
              stage(&quot;Parallel 2&quot;) {
                  steps{
                      parallel (
                          &quot;thirdTask&quot; : { 
                              build( &quot;DSL-Controll-Demo-Fibonacci-3&quot; )
                          },
                          &quot;forthTask&quot; : { 
                              build( &quot;DSL-Controll-Demo-Fibonacci-4&quot; )
                          }
                      )
                  }
              }
          }
      }   
  
      catch(all) {
          currentBuild.result = 'FAILURE'
      }   
  
      if(currentBuild.result != 'FAILURE') {
          stages{
              stage(&quot;Post Build&quot;) {
                  steps {
                      build(&quot;DSL-Controll-Demo-Fibonacci-7&quot;)
                  }   
              }   
          }
      }
  }
  </code></pre>