only if the exception is thrown on that thread the try/catch is executing on. 
If any of the instructions in the try block spawn/use another thread, 
exceptions thrown on that spawned thread will NOT be caught by your catch 
block. 

----- Original Message -----

From: [email protected] 
To: "Jenkins Users" <[email protected]> 
Sent: Thursday, August 25, 2016 5:13:06 PM 
Subject: Try/Catch around Failing Plugin 

Hi, 

I'm trying to work around this bug where XUnit XMLs parsing crashes on Windows 
10 nodes (https://issues.jenkins-ci.org/browse/JENKINS-34106) 

I thought perhaps Pipeline steps might be the way to go and wrote this: 

for ( x = 0 ; x < 5 ; x ++) { 
try { 
step ([ $class : 'XUnitPublisher' , testTimeMargin : '3000' , thresholdMode : 1 
, thresholds : [[ $class : 'FailedThreshold' , failureNewThreshold : '' , 
failureThreshold : '' , unstableNewThreshold : '' , unstableThreshold : '0' ], 
[ $class : 'SkippedThreshold' , failureNewThreshold : '' , failureThreshold : 
'' , unstableNewThreshold : '' , unstableThreshold : '' ]], tools : [[ $class : 
'GoogleTestType' , deleteOutputFiles : true , failIfNotNew : false , pattern : 
"_results/*/${config}/${arch}/tests/gtest*.xml" , skipNoTestFiles : true , 
stopProcessingIfError : true ]]]) 
break 
} catch ( any ) { // XUnit fails on Win10, try again! 
echo "XUnit crashed, trying again!" 
sleep ( 5 ) 
} 
} 

But this simply isn't working: 



... 


<blockquote>
12:08:16 [xUnit] [INFO] - Starting to record. 
12:08:16 [xUnit] [INFO] - Processing GoogleTest-1.6 
12:08:16 [xUnit] [INFO] - [GoogleTest-1.6] - 11 test report file(s) were found 
with the pattern '_results/*/release/x64/tests/gtest*.xml' relative to 
'c:\jenkins\workspace\pipeline_component_2' for the testing framework 
'GoogleTest-1.6'. 
12:08:21 [xUnit] [ERROR] - The plugin hasn't been performed correctly: remote 
file operation failed: c:\jenkins\workspace\pipeline_component_2 at 
hudson.remoting.Channel@4ef7f3ea:HOSTNAME: java.io.StreamCorruptedException: 
invalid type code: 43 
[Pipeline] } 
[Pipeline] // node 
[Pipeline] End of Pipeline 
Finished: FAILURE 
</blockquote>


Shouldn't try/catch intercept the exception? Does anyone have any other ideas 
about how I can force it to retry? 

Thanks in advance! 



-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group. 
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected] . 
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/4503604d-af57-4cf6-b5cd-1274c93eb172%40googlegroups.com
 . 
For more options, visit https://groups.google.com/d/optout . 

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/846522085.7926676.1472160282126.JavaMail.zimbra%40comcast.net.
For more options, visit https://groups.google.com/d/optout.

Reply via email to