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

Script called missing function; exception raised but not caught

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • workflow-cps-plugin
    • None
    • Jenkins v2.32
      Pipeline: Groovy 2.29 (current 2.30)

      Jenkinsfile:

      try {
        foo(); // no such method
        echo "after foo";
      } catch (e) {
        echo "caught exception";
        // throw e if you want
      } finally {
        echo "finally";
      }
      

      prints "finally", but should say "caught exception \n finally".

      Variants: define method foo(), but foo() calls bar() which is not defined.

      The catch works if you try something bad like "abc".toLong() (method not whitelisted), or a step fails (sh 'false').  Not sure what the difference is, though.

          [JENKINS-43974] Script called missing function; exception raised but not caught

          J Knurek added a comment -

          Just experienced the same issue in Jenkins v2.46.2

          Thought it might be related to JENKINS-38630 

          J Knurek added a comment - Just experienced the same issue in Jenkins v2.46.2 Thought it might be related to  JENKINS-38630  

          Jesse Glick added a comment -

          Sounds like a bug. No clue offhand what the root cause might be. Generally dealing with these kinds of things requires setting aside a day to step through groovy-cps code in a debugger.

          Jesse Glick added a comment - Sounds like a bug. No clue offhand what the root cause might be. Generally dealing with these kinds of things requires setting aside a day to step through groovy-cps code in a debugger.

            Unassigned Unassigned
            vallon Justin Vallon
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: