m_essaid
6 years agoValued Contributor
How to catch errors and exceptions
Hi,
Untill now I catch errors with the OnError event.
But I need to perform a method on "OnError", a method that is in the script.
Please consider this code :
procedure TestErrorException;
begin
  try
    // Goes to OnError event : not ok
    Aliases.MyExe.FormCptReciproque.PanelBas.XPBitBtnSaisieEcr.Click();
    
    //Goes to the finally : ok
    a_variable:= 0;
    
    //Goes to the finally : ok
    raise('I raise an exception');
    
  finally
    Log.Message('I need to go there in every case');
  end;
end;
I try to make for every case the procedure going to the finally. It works well in the case 2 and 3, but in case of not finding an object, it raises an error that trigger the OnError event.
But I still need to be into the call method, before the event to performs some steps.
Any help would be greatly appreciated