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

Fail jobs on non-ok return value? #405

Open
vassilevsky opened this issue Jan 24, 2020 · 1 comment
Open

Fail jobs on non-ok return value? #405

vassilevsky opened this issue Jan 24, 2020 · 1 comment

Comments

@vassilevsky
Copy link

Hello :)

It would have been nice to be able to fail jobs "normally" like:

def perform()
  # ...
  # Trying to do something and get a known error
  Exq.fail_job("Error while trying to do a thing: #{error}")
end

Id would be cleaner than just crashing :)

What do you think?

@patchkord
Copy link

Right now to reach this behavior I use code like this:

def fail_job(message) do
    Logger.error(message)

    # in order not to use exception to retry job,
    # send :normal exit signal to finish as failed
    exit(:normal)
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants