Hi guys !
I would like to be able to change the max attempts depending on the error raised :
- when the error raised is kind of CustomError => direct failure
- otherwise => standard DJ error process
Here is how the code could looks like :
class CustomJob
class CustomError < StandardError; end
def perform
if any_attribute_missing?
raise CustomError, "Missing attribute X"
end
process! # may raise other errors
end
def max_attempts
if error === CustomError
1
end
end
end
Thanks,
Louis