I have a pipeline with multiple steps, for example:

```
stage 'dev - compile'
node('master') {
  //do something
}

stage 'test- compile'
node('master') {
    //do something
}

stage 'prod- compile'
node('master') {
    //do something
}

```

I want to send a email if something goes wrong in the job, how can I send an email no matter where the error got triggered, something like:

```
try {
 /** 
  all the code above
  **/
 } catch(Exception e) { 
     mail the error
 } 

```