// See also: http://pastebin.com/9P0PJcyc - "how to ignore particular exception"
// See also: http://pastebin.com/ACtr0r6S - "how to silently log exception"
// See also: http://pastebin.com/QiicyV2E - "how to log all (handled) exceptions"
// See also: http://pastebin.com/rdNbEwPH - "how to get call stack on demand"
// See also: http://pastebin.com/46QkwZNi - "how to convert call stack to text"
uses
EException,
EExceptionManager;
// ...
var
EI: TEurekaExceptionInfo;
begin
try
// ...
except
EI := ExceptionManager.LastThreadException;
// or:
EI := ExceptionManager.Info(ExceptObject, ExceptAddr);
// or:
on E: Exception do
EI := ExceptionManager.Info(E);
LogException(EI);
end;
...
procedure LogException(const AEI: TEurekaExceptionInfo);
begin
if not Assigned(AEI) then
Exit;
// The code below is just example.
// You may alter it to your liking.
// Set options for "silent" exception
AEI.Options.ExceptionDialogType := edtNone; // no dialog
AEI.Options.SenderClasses := ''; // no sending
AEI.Options.AutoCrashOperation := tbNone; // no autocrash counting
AEI.Options.SaveLogFile := True; // save bug report to disk
AEI.Options.ExceptionsFilters.Clear; // ignore exception filters
// Log each exception to individual files
if ExtractFileExt(AEI.Options.OutputPath) <> '' then // if report path contains file name - delete it
AEI.Options.OutputPath := ExtractFilePath(AEI.Options.OutputPath);
AEI.Options.loAddBugIDInLogFileName := True;
AEI.Options.loAddComputerNameInLogFileName := False;
AEI.Options.loAddDateInLogFileName := False;
AEI.Options.soExcCount := True;
AEI.Options.ErrorsNumberToSave := 1;
AEI.Options.loNoDuplicateErrors := True;
AEI.Options.soAppVersionNumber := True; // <- this assumes that you are using version info; comment this otherwise
AEI.Options.loDeleteLogAtVersionChange := True; // <- this assumes that you are using version info; comment this otherwise
AEI.Options.loSaveProcessesSection := False;
// Log only exception in current thread
AEI.Options.boPauseRTLThreads := False;
AEI.Options.boPauseWindowsThreads := False;
AEI.Options.csoShowWindowsThreads := False;
AEI.Options.csoShowRTLThreads := False;
AEI.Options.csoShowELThreads := False;
// Handle this exception (save report, show dialog, send report, etc.)
ExceptionManager.Handle(AEI);
// If AEI is last exception in current thread -
// then you can use ExceptionManager.ShowLastExceptionData
// instead of ExceptionManager.Handle.
end;
// This code will perform normal processing of exception.
// I.e. all features will be invoked (such as dialogs, sending, duplicate/count merging, etc.)
// If you want to just log exception - see: http://pastebin.com/ACtr0r6S
Comments
0 B
|👍
/👎
0 B
|👍
/👎