I am using a declarative pipeline with post conditions & it sends email as expected. However in case of a failure in any stages it does not shows the actual error in the logs instead it gives below error. there is no issues with emails i received everytime. Any idea ow to catch the actual error?
[Pipeline] End of Pipeline Also:
groovy.lang.MissingPropertyException: No such property: err for class: groovy.lang.Binding at groovy.lang.Binding.getVariable(Binding.java:63)
this is my post condition
post {
always {emailext (
body: """
<html>
</html>
""",
subject: "jenkins-CICD build ${env.JOB_BASE_NAME} #${env.BUILD_NUMBER} is ${currentBuild.result}",
mimeType: 'text/html',
to: '[email protected]')}
}
A simple try-catch should work.