我正在尝试使用retry
语句存储块,但出现语法错误:Invalid retry
. 我如何正确存储它?
retries = 3
proc = Proc.new do
if retries > 0
p " Retries left: #{retries}"
retries -= 1
retry
end
end
begin
...
rescue SomeErrorOne
proc.call
rescue SomeErrorTwo
proc.call
end