send saved reports

delphi package - automated exception handling
Post Reply
slemmnord
Posts: 43
Joined: Fri Jan 17, 2014 1:04 am

send saved reports

Post by slemmnord »

Hi!

I want to upload previously saved reports to bugtracker without having a current exception.

I've had some partial success with this code:

Code: Select all

LException := madExcept.ImportBugReport('1');
with LException do
begin
  CreateBugReport := False;
  while BugReportHeader.ItemCount > 1 do BugReportHeader.Delete(0);
  while BugReportSections.ItemCount > 0 do BugReportSections.Delete(0);
  BugReportHeader.Add('contact name', 'placeholder'); -- leave one because getheader adds all the stuff back when ItemCount = 0
  BugReportSections.Add('nothing', 'empty');
  CreateBugReport := True;
  BugTrackerTitle := 'Some old reports we found';
  BugTrackerDescription := 'asdf';
end;
SendBugReport(LException.BugReport, LException.ScreenShot, AParentWnd, LException);
But this still adds some unnecessary text from the fake exception (the old reports are correctly above this) that i can't get rid of:

Code: Select all

contact name     : placeholder

nothing:
empty
It's good enough but not perfect :)

I was wondering if there some simpler way to have ME upload only the old bugreport file?

It would be useful to have a function that returns the path of stored bugreports file. For example, to test for it's existence and then ask the user if we could send unsent reports. Is there a way to get that path somehow?
Last resort would be to try and duplicate the function from how ME determines the location but ME could change it in future version.

With regards,
sn
slemmnord
Posts: 43
Joined: Fri Jan 17, 2014 1:04 am

Re: send saved reports

Post by slemmnord »

Hi again!

I just remembered, a related functionality i've wanted to achieve is to allow my users to send feature suggestions.
For this purpose, the above code again almost handles it. Just need to modify issue tracker project/area.
However, in such case i would also need to somehow disable the adding of old bugreports. Or is there some option for disabling that temporarily?

As workaround, this also could be achieved by having the exact path of reports file. Then i could rename the file temporarily, send the suggestions, and put back the file.
madshi
Site Admin
Posts: 10528
Joined: Sun Mar 21, 2004 5:25 pm

Re: send saved reports

Post by madshi »

I think you might be able to solve this by calling GetBugReport(), followed by setting BugReport := ''? Manually assigning an empty bug report may do the trick? I'm not entirely sure.

There's a setting "AppendBugReports" which you should be able to set to disable appending of old bug reports.
slemmnord
Posts: 43
Joined: Fri Jan 17, 2014 1:04 am

Re: send saved reports

Post by slemmnord »

Nope, unfortunately report headers still re-appear.

Please consider exposing the location of bugreports file in next version. It looks like there are several places where the path is determined in madExcept.pas in nearly the same way. A single, exposed, function would be better maybe?

I think functionality to retry sending of old reports might be interesting to other users as well. It is the main reason i posted the code. But it's just a bit inconvenient at the moment due to having to create a fake exception and due to not knowing if any old reports exist. I guess i'm asking if you could expose the tools to achieve it nicely or bake the feature into ME in future version :)

rgrds,
sn
Post Reply