AutoSendBugReport

delphi package - automated exception handling
Post Reply
Han312
Posts: 54
Joined: Mon Mar 14, 2016 3:49 pm

AutoSendBugReport

Post by Han312 »

I am trying to send a bug report within of a try..except block

Code: Select all

try
..
except
  begin
    s := GetCrashStackTrace();
    madExcept.SendBugReport( s, nil );
  end;
But that bug report does not look like the default 'bugreport.txt' which I would get when I don't handle the exception.
How can I change that?
madshi
Site Admin
Posts: 10753
Joined: Sun Mar 21, 2004 5:25 pm

Re: AutoSendBugReport

Post by madshi »

"GetCrashStackTrace" just gives you the stack trace, not the full bug report. If you want the full bug report, use "CreateBugReport(etNormal)".
Han312
Posts: 54
Joined: Mon Mar 14, 2016 3:49 pm

Re: AutoSendBugReport

Post by Han312 »

Thanks!
Still one small problem.

On http://help.madshi.net/HowToUseMadExcept.htm you write how to adjust the header settings.

I do that

Code: Select all

initialization
  RegisterExceptionHandler(RemoveCommandLineHeaderInfo, stDontSync, epMainPhase);
but CreateBugReport(etNormal) seems to ignore it.
madshi
Site Admin
Posts: 10753
Joined: Sun Mar 21, 2004 5:25 pm

Re: AutoSendBugReport

Post by madshi »

Yes, your exception handler is only called for true exceptions, not when you call CreateBugReport() manually. As a solution, you can either manually parse the CreateBugReport() output to remove the information you want removed. Or alternatively you can use "NewException(etNormal)" to create an exception object/interface instance. Something like this:

Code: Select all

try
  ..
except
  with NewException(etNormal) do
  begin
    BugReportHeader['command line'] := '';
    s := BugReport();
  end;
  madExcept.SendBugReport(s, nil);
end;
Post Reply