title: Determine Failed Stage in Jenkins Scripted Pipeline
body: <p>I am looking for a generic way to determine the name of the failed stage at the end of a Jenkins scripted Pipeline.</p>
  
  <p>Please note that this is different than  <a href="https://stackoverflow.com/questions/43439093/determine-failed-stage-in-jenkins-declaritive-pipeline">Determine Failed Stage in Jenkins Declaritive Pipeline</a> which is about declarative pipeline.</p>
  
  <p>Also note that use of try/catch inside each stage is out of question because it would make the pipeline script impossible to read. This is because we have like 10-15 stages which are stored in multiple files and they are compiled using JJB to create the final pipeline script.  They are already complex so I need a clean approach on finding which stage failed.</p>