Results 1 to 2 of 2

Thread: MyExceptionHandler

  1. #1

    MyExceptionHandler

    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

  2. #2

    MyExceptionHandler

    Although not always perfect: you could try MadExcept or some unit from JEDI VCL. Not very easy...

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •