你知道在Delphi代码中捕获、记录和重新引发异常的方法吗?一个简单的例子:
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);
LogThis(AException.Message);
// raise AException; - this will access violate
end;所以我需要在except块中重新引发它,但我想知道是否有更好的方法来编写我自己的方法来处理和(在特定条件下)重新引发异常。
https://stackoverflow.com/questions/2923230
复制相似问题