Details
-
Type:
Story
-
Status: Closed (View Workflow)
-
Priority:
Minor
-
Resolution: Won't Fix
-
Component/s: workflow-basic-steps-plugin
-
Labels:None
-
Similar Issues:
Description
When using error 'foo' in a scripted pipeline, it seems that the currentBuild.result or currentBuild.currentResult are not set accordingly. Here is a simple reproductible script:
node { try { echo currentBuild.currentResult error 'foo' } finally { echo currentBuild.currentResult } }
and the output is
[Pipeline] node Running on master in /tmp/jenkins-home/workspace/foo [Pipeline] { [Pipeline] echo SUCCESS [Pipeline] error [Pipeline] echo SUCCESS [Pipeline] } [Pipeline] // node [Pipeline] End of Pipeline ERROR: foo Finished: FAILURE
Is this because, in the finally block, the "exception" thrown by error happened but it not yet handled to quite the execution of the currentBuild?
That sounds right. Needs more investigation.