use Application.OnException (TApplication) or TApplicationEvents.OnException procedure (Sender: TObject; E: Exception) of Object; begin //Save Log here end;
while XXXXXX do begin try ...; ...; except Logfile.WriteLog ('this is log text.'); //如果后面动作不用执行的话,可以做下面动作 Continue;//这样就不会退出循环,继续下个循环 end; ...; ...; end;
...
except e: Exception
... // Save log
end;
begin
//Save Log here
end;
...//循环
except
...//save log
continue;//继续循环
end;
begin
try
...;
...;
except
Logfile.WriteLog ('this is log text.');
//如果后面动作不用执行的话,可以做下面动作
Continue;//这样就不会退出循环,继续下个循环
end;
...;
...;
end;