Page 1 of 1

send saved reports

Posted: Sat Dec 11, 2021 9:10 pm
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

Re: send saved reports

Posted: Sat Dec 11, 2021 10:12 pm
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.

Re: send saved reports

Posted: Mon Dec 13, 2021 9:02 am
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.

Re: send saved reports

Posted: Tue Dec 14, 2021 12:26 am
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