Ignore:
Timestamp:
Aug 17, 2011, 10:08:55 AM (13 years ago)
Author:
george
Message:
  • Modified: Now detailed info is displayed after user click Details. User will see at first only necessary error message.
  • Modified: Now methods in TStackTrace class loads call stack and exception stack only as list of frame address. Then delayed GetInfo method should be called to fully load call stack debug information. This is useful in case of external debug file where loading time could be significant.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • ExceptionLogger/UExceptionLogger.pas

    r258 r264  
    1818    FLogFileName: string;
    1919    function GetAppVersion: string;
     20    procedure SetMaxCallStackDepth(const AValue: Integer);
    2021    procedure MakeReport;
    21     procedure SetMaxCallStackDepth(const AValue: Integer);
     22    procedure ShowForm;
    2223  public
    2324    StackTrace: TStackTrace;
    2425    LastException: Exception;
     26    ExceptionSender: TObject;
    2527    IgnoreList: TStringList;
     28    procedure LoadDetails;
    2629    constructor Create(AOwner: TComponent); override;
    2730    destructor Destroy; override;
     
    146149  StackTrace.GetExceptionBackTrace;
    147150  LastException := E;
    148   if Sender is TThread then TThread.Synchronize(TThread(Sender), MakeReport)
    149     else MakeReport;
     151  ExceptionSender := Sender;
     152  if ExceptionSender is TThread then
     153    TThread.Synchronize(TThread(ExceptionSender), ShowForm)
     154    else ShowForm;
    150155end;
    151156
     
    154159  Report: TStringList;
    155160begin
     161  StackTrace.GetInfo;
    156162  if IgnoreList.IndexOf(LastException.ClassName) = -1 then begin
    157163    Report := TStringList.Create;
     
    170176      IgnoreList.Add(LastException.ClassName);
    171177  end;
     178end;
     179
     180procedure TExceptionLogger.ShowForm;
     181begin
     182  ExceptionForm.Logger := Self;
     183  ExceptionForm.LabelMessage.Caption := LastException.Message;
     184  ExceptionForm.MemoExceptionInfo.Clear;
     185  if not ExceptionForm.Visible then ExceptionForm.ShowModal;
     186end;
     187
     188procedure TExceptionLogger.LoadDetails;
     189begin
     190  if ExceptionSender is TThread then
     191    TThread.Synchronize(TThread(ExceptionSender), MakeReport)
     192    else MakeReport;
    172193end;
    173194
Note: See TracChangeset for help on using the changeset viewer.