On Thu, Apr 6, 2017 at 6:47 AM, Christian McHugh
<christian.mch...@gmail.com> wrote:
> Would a custom exception allow for returning the requested output

Yes, if you add a `@Whitelisted` getter.

Throwing an exception is the appropriate way to indicate failure. By
default the error will be “thrown up” and fail the build but a script
may choose to catch and handle it somehow, or a `retry` step may
process it, etc. In Declarative Pipeline the appropriate `post`-blocks
will be run before terminating the build.

Historically, some build steps designed for use in freestyle projects
directly set the build result to `FAILURE` and printed a message from
`perform`. Or they may have returned `false` after printing a message.
Neither idiom plays well with Pipeline and is discouraged generally.
(To make it harder to use the latter bad idiom innocently,
`SimpleBuildStep.perform` declares a void return value: you should
rather throw `AbortException` with a detail message.)

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/CANfRfr0G_im5JWu7ink4mcO91Xxm%3D1Fwprz4T%3DXBMCcPJ5M2JA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to