Posted on

How to Retry after exception in Delphi

//Code sample to retry if exception occured for 5 times

var i : integer;
    r : integer;

r := 5;

for i := 1 to r do 
begin
  try
    <Code>
    <code>
    break;
  except
    <Report/Log failure, prepare for next iteration>
  end;
end;