Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-45379

An error in a "finally" block will result in squelching the original exception thrown

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • workflow-cps-plugin
    • None

      Considering the following contrived Jenkinsfile:

      node {
          try {
              echo "I'm too cool to stash"
              1 / 0 
          }
      finally {
              unstash 'invalid'
              echo "Did you see the exception?"
          }
      }
      

      The exception thrown in the try block will never ever get printed in the Console Output. This is pretty frustrating as it hides the original error from me :'(, see below:

      Started by user admin
      Replayed #3
      [Pipeline] node
      Running on master in /var/jenkins_home/workspace/foo
      [Pipeline] {
      [Pipeline] echo
      I'm too cool to stash
      [Pipeline] unstash
      [Pipeline] }
      [Pipeline] // node
      [Pipeline] End of Pipeline
      ERROR: No such saved stash ‘invalid’
      Finished: FAILURE
      

          [JENKINS-45379] An error in a "finally" block will result in squelching the original exception thrown

            Unassigned Unassigned
            rtyler R. Tyler Croy
            Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: