title: try/catch/finally masks Jenkinsfile problems in case of groovy compiler exceptions
body: <p>I have code similar to the one below in my Jenkinsfile:</p>
  
  <pre><code>node {
     checkout scm
     // do some stuff
     try {
         // do some maven magic
     } catch (error) {
         stage "Cleanup after fail"
         emailext attachLog: true, body: "Build failed (see ${env.BUILD_URL}): ${error}", subject: "[JENKINS] ${env.JOB_NAME} failed", to: 'someone@example.com'
         throw error
     } finally {
         step $class: 'JUnitResultArchiver', testResults: '**/TEST-*.xml'
     }
  }
  </code></pre>
  
  <p>If the above code fails because of some jenkins-pipeline related errors in the <code>try { }</code> (e.g. using unapproved static method) the script fails silently. When I remove the try/catch/finally I can see the errors.
  Am I doing something wrong? Shouldn't rethrowing <code>error</code> make the pipeline errors appear in the log?</p>
  
  <p>EDIT:
  I've managed to nail down the problem to groovy syntax, when e.g. I use a variable that hasn't been assigned yet.
  Example:
  <code>
  echo foo
  </code>
  If <code>foo</code> is not declared/assigned anywhere Jenkins will fail the build and won't show the reason if it is inside the try/catch/finally which rethrows the exception.</p>