%error details% in the mail body

delphi package - automated exception handling
Post Reply
Jacobh
Posts: 30
Joined: Tue Aug 30, 2005 9:01 am

%error details% in the mail body

Post by Jacobh »

Hi madshi!

Is it possible for the error details to be the mail body? I mean, the description of the problem that the user enters in the details form of the assistant.

In other words, I miss the variable %error details%.

Thanks :wink:
Jacob
madshi
Site Admin
Posts: 10766
Joined: Sun Mar 21, 2004 5:25 pm

Post by madshi »

%bugreport%

:wink:
Jacobh
Posts: 30
Joined: Tue Aug 30, 2005 9:01 am

Post by Jacobh »

Thanks madshi.

What I meant is the string, like
error details:
I pressed the "Print" button and then ...
be the body of the email.

It is smart when replying to a bug report email. Then the body of the email will be the description of the problem that the user sent to me.

That's the natural way for the user to understand what the mail is about. The %bugreport% doesn't make much sense to the user.

Do you understand? :wink:

Cheers
Jacob[/i]
madshi
Site Admin
Posts: 10766
Joined: Sun Mar 21, 2004 5:25 pm

Post by madshi »

Ah sorry, misunderstood you.

Well, the assistants are totally flexible. Basically I just set up a default assistant for your comfort, but everybody is able to totally change them. So there is no such thing as a fixed "error details" field. In my default assistant such a memo box exists, but everybody can configure it away. For madExcept it's a memo like any other assistant memo. So something like "%error details%" won't work.

However, you can easily realize it yourself. Just call RegisterExceptActionHandler to be notified when a mail is sent. Then change the mail body, so that it contains the error details the user entered. E.g. something this one:

Code: Select all

procedure YourExceptActionHandler(action           : TExceptAction;
                                  const exceptIntf : IMEException;
                                  var handled      : boolean      );
begin
  if action = eaSendBugReport then
    exceptIntf.MailBody := exceptIntf.BugReportSections['error details'];
end;

initialization
  RegisterExceptActionHandler(YourExceptActionHandler, stDontSync);
end.
Jacobh
Posts: 30
Joined: Tue Aug 30, 2005 9:01 am

Post by Jacobh »

Hi

Only problem is, that the handler is called before the page of the assistant is shown and the user has entered the text.

Is there a way for it to be called later ?

Thanks
Jacob
madshi
Site Admin
Posts: 10766
Joined: Sun Mar 21, 2004 5:25 pm

Post by madshi »

Ouch, you're right.

Well, you could use the "OnAction" handler of the "DetailsForm".
Jacobh
Posts: 30
Joined: Tue Aug 30, 2005 9:01 am

Post by Jacobh »

OK. I'm almost there.

How do I get the

exceptIntf : IMEException

interface in that handler?

Thx
Jacob
madshi
Site Admin
Posts: 10766
Joined: Sun Mar 21, 2004 5:25 pm

Post by madshi »

You can typecast the last parameter to "IMEException". Or you can directly write "exceptIntf: IMEException" instead of "exception: IUnknown".
Jacobh
Posts: 30
Joined: Tue Aug 30, 2005 9:01 am

Post by Jacobh »

Great. It works :crazy:

Here is my code.

Code: Select all

var
  madErrorDetails: string;

procedure DetailsSet(form: INVForm; action: TNVAction; item: INVItem; exceptIntf: IMEException);
begin
  if form <> nil then begin
    if Form.Name = 'DetailsForm' then
      if item <> nil then
        if item.Name = 'DetailsMemo' then
          madErrorDetails := (item as INVEdit).Text
        else if item.Name = 'ContinueBtn' then
          if Assigned(exceptIntf) then
            exceptIntf.MailBody := madErrorDetails
  end;
end;
Thanks
Jacob
Post Reply