Skip to content

Commit

Permalink
Added the exception e
Browse files Browse the repository at this point in the history
  • Loading branch information
annaibm committed Oct 29, 2024
1 parent 638d78d commit 57c469d
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions buildenv/jenkins/JenkinsfileBase
Original file line number Diff line number Diff line change
Expand Up @@ -793,14 +793,7 @@ def runTest( ) {
}
}
} catch (Exception e) {
echo "An error occurred: ${e.message}"
if (e.toString().contains("FlowInterruptedException")) {
wasAborted = true
currentBuild.result = 'ABORTED'
echo "Build aborted by user or another trigger."
} else {
currentBuild.result = 'FAILURE'
}
handleException(e)
} finally {
// Cleanup: Terminate any running processes if the build was aborted
if (wasAborted || currentBuild.result == 'ABORTED') {
Expand Down Expand Up @@ -839,6 +832,17 @@ def runTest( ) {
}
}

def handleException(Exception e) {
// Handle exceptions and set build status accordingly
echo "An error occurred: ${e.message}"
if (e.toString().contains("FlowInterruptedException")) {
currentBuild.result = 'ABORTED'
echo "Build aborted by user or another trigger."
} else {
currentBuild.result = 'FAILURE'
}
}

def checkTestResults(results) {
if (results.isEmpty()) {
return
Expand Down

0 comments on commit 57c469d

Please sign in to comment.