Firlefanz
21-09-2006, 12:57 PM
Hi!
In my programs I always use a custom Exceptionhandler:
procedure MyExceptionHandler(Sender : TObject; E : Exception );
In FormCreate:
Application.OnException:=MyExceptionHandler;
It writes the error with the date to an Ini File so I can review the error.
procedure TForm1.MyExceptionHandler(Sender: TObject; E: Exception);
var xini: tinifile;
sec: string;
begin
sec:='Innominate';
inc(nerrorcount);
if nerrorcount<1000 then begin
try
xini:=tinifile.create(sprogdir+'Errorlog.txt');
xini.WriteString(sec,'Error'+inttostr(nerrorcount) ,datetostr(date)+' '+timetostr(time)+' '+e.Message);
xini.free;
except;
end;
end;
end;
What additional data can I get?
The procedure of function with the line maybe or the object or property causing the error?
Any idea how to improve this?
Do you have a better way?
Thanks,
Firle
In my programs I always use a custom Exceptionhandler:
procedure MyExceptionHandler(Sender : TObject; E : Exception );
In FormCreate:
Application.OnException:=MyExceptionHandler;
It writes the error with the date to an Ini File so I can review the error.
procedure TForm1.MyExceptionHandler(Sender: TObject; E: Exception);
var xini: tinifile;
sec: string;
begin
sec:='Innominate';
inc(nerrorcount);
if nerrorcount<1000 then begin
try
xini:=tinifile.create(sprogdir+'Errorlog.txt');
xini.WriteString(sec,'Error'+inttostr(nerrorcount) ,datetostr(date)+' '+timetostr(time)+' '+e.Message);
xini.free;
except;
end;
end;
end;
What additional data can I get?
The procedure of function with the line maybe or the object or property causing the error?
Any idea how to improve this?
Do you have a better way?
Thanks,
Firle