Not sure if I understand you correctly, just do try catch like java code 

Scripted:
stage ('abc') {
  try {
    sh "rm file'
  } catch (e) {
    echo "Error deleting file!"
  }
}

Declarative:
stage ('abc') {
  script {
    try {
      sh "rm file'
    } catch (e) {
      echo "Error deleting file!"
    }
  }
}


-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/0ef015be-3335-416f-ae2e-ae6cebbb0b1d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to