Board index » delphi » Ya think this would this work? Try/try/post/except/post/except/error

Ya think this would this work? Try/try/post/except/post/except/error

Do you think this would this work? The idea is to retry a failed post
one more time before displaying an error and moving on.  The essence of
the question is whether an error on the second post would be trapped by
the second except.

Oh, also: is it lame or nice?  TIA...

try
   try
      post ;
   except
     delay(0.2) ;
     post ;
   end ;
except
  showmessage('Couldn''t post your updates,  sorry.') ;
end ;

 

Re:Ya think this would this work? Try/try/post/except/post/except/error


Either use a for loop to enclose a single try block and execute it twice or
nest the inner try block inside the outer except block.

try
  ...
except
  try...

--
Bill Todd
(Sorry but TeamB cannot answer questions received via email)
(Remove nospam from my email address to contact me for any other reason)

Re:Ya think this would this work? Try/try/post/except/post/except/error


Quote
Bill Todd (TeamB) wrote:
> Either use a for loop to enclose a single try block and execute it twice or
> nest the inner try block inside the outer except block.

Kind of like this?

for trycount := 1 to 2 do begin
  try
    post ;
    exit ;
  except
    if trycount = 2 then
      showmessage('Couldn''t post your updates,  sorry.')
   else
      delay(0.2) ;
  end ;
end ;

Re:Ya think this would this work? Try/try/post/except/post/except/error


Thanks again...

Other Threads