Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make it easy to fail a job #623

Open
josephjclark opened this issue Mar 13, 2024 · 0 comments
Open

Make it easy to fail a job #623

josephjclark opened this issue Mar 13, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@josephjclark
Copy link
Collaborator

When a workflow runs, we generate an exit reason.

Basically if the last step didn't throw, we call the run a success. Even if there's a fail in the middle somewhere.

We usually assume that if there was an error but the last step succeeded, then the error was handled and all is well.

But! A common use case is to send an email on error. But if the email step succeeds, you still want to consider the run a fail. This run did not recover, it failed and reported the fail. Its misleading to call this a success.

So in my error reporting step, I need to say "Send the email and then return an error". And probably the final error needs to be the upstream error.

Right now you would probably do this by throwing the downstream error. Kind of awkward - you have to find the right error on state based on the job name (or job id?). And the throw is kinda weird itself.

So (and this has come up before): we need maybe a common helper called exit(). If you exit without an error, we'll stop the whole workflow with success (regardless of everything else that happened. If you exit with an error, that error will be used to force a fail.

We might also want a helper to make it easy to load an error object (getLastError() seems nice)

@josephjclark josephjclark added the enhancement New feature or request label Mar 13, 2024
@github-project-automation github-project-automation bot moved this to New Issues in v2 Mar 13, 2024
@christad92 christad92 moved this from New Issues to Backlog in v2 Mar 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Backlog
Development

No branches or pull requests

1 participant