try except block in Delphi
- by Nik
Do you guys know a way to trap log and re-raise exception in Delphi code.
A simple example:
procedure TForm3.Button1Click(Sender: TObject);
begin
try
raise Exception.Create('Bum');
except
on E: Exception do
begin
MyHandleException(E);
end;
end;
end;
procedure TForm3.MyHandleException(AException: Exception);
begin
ShowMessage(AException.Message);
// raise AException; - this will access violate
end;
So I need to re-raise it in the except block but I was wondering is there a better way to write my own method to handle and (on specific conditions) to re-raise exceptions?