Skip to content

Commit f4909f4

Browse files
committed
Added the exception e
1 parent c6d404f commit f4909f4

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

buildenv/jenkins/JenkinsfileBase

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -793,14 +793,7 @@ def runTest( ) {
793793
}
794794
}
795795
} catch (Exception e) {
796-
echo "An error occurred: ${e.message}"
797-
if (e.toString().contains("FlowInterruptedException")) {
798-
wasAborted = true
799-
currentBuild.result = 'ABORTED'
800-
echo "Build aborted by user or another trigger."
801-
} else {
802-
currentBuild.result = 'FAILURE'
803-
}
796+
handleException(e)
804797
} finally {
805798
// Cleanup: Terminate any running processes if the build was aborted
806799
if (wasAborted || currentBuild.result == 'ABORTED') {
@@ -839,6 +832,17 @@ def runTest( ) {
839832
}
840833
}
841834

835+
def handleException(Exception e) {
836+
// Handle exceptions and set build status accordingly
837+
echo "An error occurred: ${e.message}"
838+
if (e.toString().contains("FlowInterruptedException")) {
839+
currentBuild.result = 'ABORTED'
840+
echo "Build aborted by user or another trigger."
841+
} else {
842+
currentBuild.result = 'FAILURE'
843+
}
844+
}
845+
842846
def checkTestResults(results) {
843847
if (results.isEmpty()) {
844848
return

0 commit comments

Comments
 (0)