delphi package - automated exception handling
Han312
Posts: 54 Joined: Mon Mar 14, 2016 3:49 pm
Post
by Han312 » Fri Feb 02, 2018 3:08 pm
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: 10764 Joined: Sun Mar 21, 2004 5:25 pm
Post
by madshi » Fri Feb 02, 2018 3:54 pm
"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
Post
by Han312 » Tue Feb 06, 2018 10:02 am
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: 10764 Joined: Sun Mar 21, 2004 5:25 pm
Post
by madshi » Tue Feb 06, 2018 10:10 am
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;