Skip to content

Instantly share code, notes, and snippets.

@mitio
Last active April 3, 2023 14:43
Show Gist options
  • Save mitio/133809a061a21b54c04ab6ca0d70fd8b to your computer and use it in GitHub Desktop.
Save mitio/133809a061a21b54c04ab6ca0d70fd8b to your computer and use it in GitHub Desktop.
Jenkins Pipeline error handling methods

unstable(message):

  • like a warning: doesn't abort nor the current step, neither the entire build, code continues running
  • current step is flagged in orange
  • the build is flagged as UNSTABLE (if not already flagged as FAILED as build status can only get worse, not better)
  • the step's log is not expanded by default in BlueOcean

error(message):

  • like an exception, similar to throw new Exception(message): aborts both the current step as well as the entire build (only code from current parallel steps continues until completion)
  • current step is flagged in red
  • the build is flagged as FAILED
  • the step's log is expanded in BlueOcean

warnError(message):

  • like a warning: doesn't abort nor the current step, neither the entire build, code continues running
  • current step is flagged in red
  • the build is flagged as UNSTABLE (if not already flagged as FAILED as build status can only get worse, not better)
  • the step's log is expanded in BlueOcean
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment