Page 1 of 1

AutoSendBugReport

Posted: Fri Feb 02, 2018 3:08 pm
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?

Re: AutoSendBugReport

Posted: Fri Feb 02, 2018 3:54 pm
by madshi
"GetCrashStackTrace" just gives you the stack trace, not the full bug report. If you want the full bug report, use "CreateBugReport(etNormal)".

Re: AutoSendBugReport

Posted: Tue Feb 06, 2018 10:02 am
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.

Re: AutoSendBugReport

Posted: Tue Feb 06, 2018 10:10 am
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;