MadExceptionHandlerExceptAction

delphi package - automated exception handling
Post Reply
FredS
Posts: 98
Joined: Mon May 11, 2015 9:42 pm

MadExceptionHandlerExceptAction

Post by FredS »

Hi,

The exceptIntf is not returning the correct values for VersionVar, ExceptMessage and MailFrom inside the VCL ExceptAction event. Am I missing a step?

Code: Select all

procedure TMainForm.MadExceptionHandlerExceptAction(action: TExceptAction; const exceptIntf: IMEException; var handled: Boolean);
begin
  if action = eaSendBugReport2 then begin // after assistant
    { - Fill Vars }
    bugreport := exceptIntf.bugreport;
    Subject := exceptIntf.VersionVar + ' - ' + exceptIntf.ExceptMessage;
....
FredS
Posts: 98
Joined: Mon May 11, 2015 9:42 pm

Re: MadExceptionHandlerExceptAction

Post by FredS »

All works now and I have no idea why..

However the subject lines of the BugTracker system shows this:

2.0.0.1076 - %exceptMsg% - ($e1947924, $8f183040, $2c20e4df)
-> used subject := exceptIntf.BugTrackerTitle
%AppVersion% was correctly expanded but not %exceptMsg%. The crc was added by parsing the bugreport, I copied ExtractBugReportHeaderField to do that. Might I suggest you make that public.

next entry:
- An error occurred in the application.
-> used subject := exceptIntf.VersionVar + ' - ' + exceptIntf.ExceptMsg for that one

next entry:
- Support Request. - <email>
-> Note Version is missing but ExceptMsg worked, <email> also worked
-> used subject := exceptIntf.VersionVar + ' - ' + exceptIntf.ExceptMsg + ' - ' + exceptIntf.MailFrom

next entry:
2.0.0.1076 - Support Request. - <email>
Since some worked and some didn't I went back to the original code with the additon of email:
used subject := exceptIntf.BugTrackerTitle + ' - ' + exceptIntf.MailFrom

Good thing Delphi saves those history files..
madshi
Site Admin
Posts: 10753
Joined: Sun Mar 21, 2004 5:25 pm

Re: MadExceptionHandlerExceptAction

Post by madshi »

"exceptIntf.VersionVar" is for madExcept 2.x compatability, it's mostly useless/empty now.

I'm not completely sure which parts are working now and which don't. Can you clarify?

I'll export ExtractBugReportHeaderField in the next build, no problem.
FredS
Posts: 98
Joined: Mon May 11, 2015 9:42 pm

Re: MadExceptionHandlerExceptAction

Post by FredS »

madshi wrote:"exceptIntf.VersionVar" is for madExcept 2.x compatability, it's mostly useless/empty now.
I'm not completely sure which parts are working now and which don't. Can you clarify?
I'll export ExtractBugReportHeaderField in the next build, no problem.
All is working now, and I still don't know what happened other than replacing VersionVar with one of my own functions.
If it wasn't so simply to match the code changes with the Bug Tracker entries I wouldn't even have posted.

Perhaps just some Voodoo Magic..
madshi
Site Admin
Posts: 10753
Joined: Sun Mar 21, 2004 5:25 pm

Re: MadExceptionHandlerExceptAction

Post by madshi »

Well, I'm just glad to hear it works now. Not sure what went wrong in the first place.
FredS
Posts: 98
Joined: Mon May 11, 2015 9:42 pm

Re: MadExceptionHandlerExceptAction

Post by FredS »

madshi wrote:Well, I'm just glad to hear it works now. Not sure what went wrong in the first place.
Neither did I, therefore the fishing expedition..

One more thing, I am after the Return msg after using HttpUpload.

I made some source changes that will help me but perhaps I can get you to add a generic return value to your code.
Essentially all I did is return s1 in an existing Field, but that could just as easily be a new field called "ReceiveResponse" and we won't need to alter your code.

Code: Select all

function TWinHttp.Post(const mailFrom: UnicodeString; const fields: IMEFields; const attachFiles, attachSendAs, attachFields: TDAUnicodeString) : boolean;
var fileCount   : integer;
    fileHandles : TDANativeUInt;
    fileSizes   : TDACardinal;
    s1          : AnsiString;
begin
  result := false;
  if OpenAttachFiles(FPA, FSettings, attachFiles, fileHandles, fileSizes, fileCount, false, false) then begin
    FPA.AreaDone;
    result := InternalPost(FUrl, mailFrom, fileHandles, fileSizes, attachSendAs, attachFields, fields, s1);
    fields.Contents['ScoutDefaultMessage'] := s1;
    CloseAttachFiles(fileHandles);
  end;
end;
From BugzScout docs:
The Success payload returns with either the DefaultMessage property provided when the bug was submitted, or a message added by someone on the bug server, such as "This bug has been fixed in version 2.0. Please upgrade." If you choose, you can show this to your users after the bug was submitted to give them an idea of why that bug happened or how to fix it.
madshi
Site Admin
Posts: 10753
Joined: Sun Mar 21, 2004 5:25 pm

Re: MadExceptionHandlerExceptAction

Post by madshi »

The next madExcept build will export the following global variable:

Code: Select all

var LastHttpPostReply : AnsiString = '';   // last reply from the server when doing an HTTP post
Not very pretty, but should do the trick for now.
FredS
Posts: 98
Joined: Mon May 11, 2015 9:42 pm

Re: MadExceptionHandlerExceptAction

Post by FredS »

Thanks, will make a note of it.
Post Reply