In Ruby, I can write:
begin
do_something # exception raised
rescue
# handles error
retry # restart from beginning
end
Is there something similar in Groovy/Java?
I found this but maybe there is something better ?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You could build up your own helper method in Groovy to encapsulate this retry logic.
(Assuming a definition of MultipleFailureException similar to GPars’ AsyncException)
then in code, you could use this method as follows.
or, with a different number of retries and error handling behaviour: