How to customize Assitants using Exception Filter?

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

Re: How to customize Assitants using Exception Filter?

Post by FredS »

But while we are on the subject how would one show the "Please Wait" dialog from within an ExceptAction Handler?
madshi
Site Admin
Posts: 10749
Joined: Sun Mar 21, 2004 5:25 pm

Re: How to customize Assitants using Exception Filter?

Post by madshi »

> I get a "Please Wait" for a second or two then nothing.

So "ssNothing" does work, after all? Without setting "ssNothing" you get the full exception dialog, don't you?
FredS
Posts: 98
Joined: Mon May 11, 2015 9:42 pm

Re: How to customize Assitants using Exception Filter?

Post by FredS »

madshi wrote:> I get a "Please Wait" for a second or two then nothing.

So "ssNothing" does work, after all? Without setting "ssNothing" you get the full exception dialog, don't you?
Sort of, it doesn't send anything. But regardless that's not what I want:
1) I want the assistant to show up
2) I want it to continue to ExceptAction handler with eaSendBugReport2

The only reason "Please Wait" didn't show up my real project is because I haven't figured out how to show it inside the ExceptAction handler.
madshi
Site Admin
Posts: 10749
Joined: Sun Mar 21, 2004 5:25 pm

Re: How to customize Assitants using Exception Filter?

Post by madshi »

Do you have "automatically send bug report" checked in the madExcept settings?
FredS
Posts: 98
Joined: Mon May 11, 2015 9:42 pm

Re: How to customize Assitants using Exception Filter?

Post by FredS »

madshi wrote:Do you have "automatically send bug report" checked in the madExcept settings?
No

EDIT:

But that makes no difference:

Code: Select all

procedure TForm1.MadExceptionHandler1ExceptAction(action: TExceptAction; const exceptIntf: IMEException; var handled: Boolean);
begin
   if (action=eaSendBugReport2) then
     Beep;
end;

procedure TForm1.btRaiseClick(Sender: TObject);
begin
  raise Exception.Create('Error Message');
end;

procedure TForm1.MadExceptionHandler1Exception(const exceptIntf: IMEException; var handled: Boolean);
begin
  exceptIntf.ShowSetting := ssNothing;
  exceptIntf.SendAssistant := 'PrintAssistant';
end;

Code: Select all

[GeneralSettings]
MesVersion=4
HandleExceptions=1
LinkInCode=1
AppendMapFileToBinary=1
NoOwnMadExceptSettings=0
CheckFileCrc=0
CheckForFrozenMainThread=1
FreezeTimeout=60000
ReportLeaks=0
WindowsLogo=0
CrashOnBuffer=0
CrashOnUnderrun=0
AutomaticallySaveBugReport=0
AutoSaveBugReportIfNotSent=1
AutomaticallyMailBugReport=1
AutoMailProgressBox=1
CopyBugReportToClipboard=0
SuspendAllRunningThreads=0
ShowPleaseWaitBox=1
PleaseWaitIcon=plwait1
AutomaticallyContinueApplication=0
AutomaticallyRestartApplication=0
AutomaticallyCloseApplication=0
SendInBackground=0
SendHelper=131074
Send32Icon=send321
UploadViaHttp=0
HttpServer=
HttpSsl=1
HttpPort=0
HttpAccount=
HttpPassword=
UploadToFogBugz=0
UploadToBugZilla=0
UploadToMantis=0
BugTrackerAccount=
BugTrackerPassword=
BugTrackerProject=
BugTrackerArea=
BugTrackerAssignTo=
MailAsSmtpServer=0
MailAsSmtpClient=0
SmtpServer=
SmtpSsl=0
SmtpTls=0
SmtpPort=0
SmtpAccount=
SmtpPassword=
MailViaMapi=0
MailViaMailto=1
MailAddress=me@fakeemail.com
BugReportFile=bugreport.txt
AttachBugReport=0
AttachBugReportFile=1
DeleteBugReportFile=1
BugReportSendAs=bugreport.mbr
BugReportZip=
ScreenShotDepth=0
ScreenShotAppOnly=1
ScreenShotSendAs=screenshot.png
ScreenShotZip=
AdditionalAttachments=
AppendBugReports=1
BugReportFileSize=100000
DontSaveDuplicateExceptions=1
DontSaveDuplicateFreezings=1
DuplicateExceptionDefinition=1
DuplicateFreezeDefinition=2
ShowExceptionBox=1
OkBtnText=&OK
DetailsBtnText=&Details
PleaseWaitTitle=Information
PleaseWaitText=Please wait a moment...
BugTrackerTitle=%25appname%25, %25exceptMsg%25
BugTrackerDescr=error details: %0d%0a%25errorDetails%25
MailSubject=bug report
MailBody=please find the bug report attached
SendBoxTitle=Sending bug report...
PrepareAttachMsg=Preparing attachments...
MxLookupMsg=Searching for mail server...
ConnectMsg=Connecting to server...
SendMailMsg=Sending mail...
FieldsMsg=Setting fields...
SendAttachMsg=Sending attachments...
SendFinalizeMsg=Finalizing...
MailFailureMsg=Sorry, sending the bug report didn't work.
VersionVariable=
[ExceptionBox]
ShowButtonMailBugReport=1
ShowButtonSaveBugReport=1
ShowButtonPrintBugReport=0
ShowButtonShowBugReport=1
ShowButtonContinueApplication=1
ShowButtonRestartApplication=1
ShowButtonCloseApplication=1
IconButtonSendBugReport=send1
IconButtonSaveBugReport=save1
IconButtonPrintBugReport=print1
IconButtonShowBugReport=show1
IconButtonContinueApplication=continue1
IconButtonCantContinueApplication=cantContinue1
IconButtonRestartApplication=restart1
IconButtonCloseApplication=close1
FocusedButton=0
SendAssistant=SendAssistant
SaveAssistant=SaveAssistant
PrintAssistant=PrintAssistant
AutomaticallyShowBugReport=0
NoOwnerDrawButtons=0
BigExceptionIcon=big1
TitleBar=%25appname%25
ExceptionMessage=An error occurred in the application.
FrozenMessage=The application seems to be frozen.
BitFaultMsg=The file "%25modname%25" seems to be corrupt!
MailBugReportText=send bug report
SaveBugReportText=save bug report
PrintBugReportText=print bug report
ShowBugReportText=show bug report
ContinueApplicationText=continue application
RestartApplicationText=restart application
CloseApplicationText=close application
[BugReport]
ListThreads=1
ListModules=1
ListHardware=1
ShowCpuRegisters=1
ShowStackDump=1
Disassembly=1
HideUglyItems=0
ShowRelativeAddrs=1
ShowRelativeLines=1
FormatDisassembly=0
LimitDisassembly=5
EnabledPlugins=modules|processes|hardware
[Filters]
Filter1ExceptionClasses=
Filter1DontCreateBugReport=1
Filter1DontCreateScreenshot=1
Filter1DontSuspendThreads=1
Filter1DontCallHandlers=1
Filter1ShowBox=3
Filter1Assis=
Filter2ExceptionClasses=
Filter2DontCreateBugReport=0
Filter2DontCreateScreenshot=0
Filter2DontSuspendThreads=0
Filter2DontCallHandlers=0
Filter2ShowBox=0
Filter2Assis=
GeneralDontCreateBugReport=0
GeneralDontCreateScreenshot=0
GeneralDontSuspendThreads=0
GeneralDontCallHandlers=0
GeneralShowBox=0
GeneralAssis=
[Assistants]
Assistant1=SendAssistant|Send Assistant|ContactForm|DetailsForm|ScrShotForm
Assistant2=SaveAssistant|Save Assistant|ContactForm|DetailsForm
Assistant3=PrintAssistant|Print Assistant|ContactForm|DetailsForm
Forms1=TPF0%0eTMEContactForm%0bContactForm%07Message%0c%13%00%00%00Contact Information%08MinWidth%04%00%00%00%00%08OnAction%0c%1b%00%00%00madExcept.HandleContactForm%05Timer%04%00%00%00%00%00%09INVButton%0bContinueBtn%07Caption%0c%08%00%00%00Continue%07Enabled%09%0bNoOwnerDraw%08%07Visible%09%00%00%09INVButton%07SkipBtn%07Caption%0c%04%00%00%00Skip%07Enabled%08%0bNoOwnerDraw%08%07Visible%09%00%00%09INVButton%09CancelBtn%07Caption%0c%06%00%00%00Cancel%07Enabled%09%0bNoOwnerDraw%08%07Visible%09%00%00%08INVLabel%06Label1%07Caption%0c%0a%00%00%00your name:%07Enabled%09%07Spacing%04%00%00%00%00%00%00%07INVEdit%08NameEdit%07Colored%09%07Enabled%09%05Lines%04%01%00%00%00%08Optional%09%0aOutputName%0c%0c%00%00%00contact name%0aOutputType%07%09nvoHeader%07Spacing%04%00%00%00%00%04Text%0c%00%00%00%00%05Valid%09%00%00%08INVLabel%06Label2%07Caption%0c%0b%00%00%00your email:%07Enabled%09%07Spacing%04%00%00%00%00%00%00%07INVEdit%09EmailEdit%07Colored%09%07Enabled%09%05Lines%04%01%00%00%00%08Optional%08%0aOutputName%0c%0d%00%00%00contact email%0aOutputType%07%09nvoHeader%07Spacing%04%00%00%00%00%04Text%0c%00%00%00%00%05Valid%09%00%00%0bINVCheckBox%08MemCheck%07Caption%0c%0b%00%00%00remember me%07Checked%08%07Enabled%09%0aOutputName%0c%00%00%00%00%07Spacing%04%00%00%00%00%00%00%00
Forms2=TPF0%0eTMEDetailsForm%0bDetailsForm%07Message%0c%0d%00%00%00Error Details%08MinWidth%04%00%00%00%00%08OnAction%0c%00%00%00%00%05Timer%04%00%00%00%00%00%09INVButton%0bContinueBtn%07Caption%0c%08%00%00%00Continue%07Enabled%09%0bNoOwnerDraw%08%07Visible%09%00%00%09INVButton%07SkipBtn%07Caption%0c%04%00%00%00Skip%07Enabled%09%0bNoOwnerDraw%08%07Visible%09%00%00%09INVButton%09CancelBtn%07Caption%0c%06%00%00%00Cancel%07Enabled%09%0bNoOwnerDraw%08%07Visible%09%00%00%08INVLabel%06Label1%07Caption%0c,%00%00%00what were you doing when the error occurred?%07Enabled%09%07Spacing%04%00%00%00%00%00%00%07INVEdit%0bDetailsMemo%07Colored%09%07Enabled%09%05Lines%04%09%00%00%00%08Optional%08%0aOutputName%0c%0d%00%00%00error details%0aOutputType%07%0dnvoOwnSection%07Spacing%04%00%00%00%00%04Text%0c%00%00%00%00%05Valid%09%00%00%00
Forms3=TPF0%0eTMEScrShotForm%0bScrShotForm%0dActiveControl%07%0bContinueBtn%07Message%0c%18%00%00%00Screenshot Configuration%08MinWidth%04%00%00%00%00%08OnAction%0c%1e%00%00%00madExcept.HandleScreenshotForm%05Timer%04%fa%00%00%00%00%09INVButton%0bContinueBtn%07Caption%0c%08%00%00%00Continue%07Enabled%09%0bNoOwnerDraw%08%07Visible%09%00%00%09INVButton%07SkipBtn%07Caption%0c%04%00%00%00Skip%07Enabled%08%0bNoOwnerDraw%08%07Visible%09%00%00%09INVButton%09CancelBtn%07Caption%0c%06%00%00%00Cancel%07Enabled%09%0bNoOwnerDraw%08%07Visible%09%00%00%0bINVCheckBox%0bAttachCheck%07Caption%0c%25%00%00%00attach a screenshot to the bug report%07Checked%09%07Enabled%09%0aOutputName%0c%00%00%00%00%07Spacing%04%00%00%00%00%00%00%08INVImage%0aScrShotImg%06Border%09%09Clickable%09%07Enabled%09%04File%0c%00%00%00%00%06Height%04%00%00%00%00%07Spacing%04%00%00%00%00%05Width%04%00%00%00%00%00%00%08INVLabel%06Label1%07Caption%0c%15%00%00%00(click to edit image)%07Enabled%09%07Spacing%04%00%00%00%00%00%00%00
madshi
Site Admin
Posts: 10749
Joined: Sun Mar 21, 2004 5:25 pm

Re: How to customize Assitants using Exception Filter?

Post by madshi »

Then why should madExcept send the bug report? :) It only does that if you ask it to.

You can do "exceptIntf.AutoSend := true" to activate automatic sending. However, this needs to be set early enough. You seem to be using the madExcept VCL component to register your exception handler? Try manually calling RegisterExceptionHandler() instead, that will give you more control over how and when your handler will get calledl I'd suggest "epQuickFiltering" to make sure that your handler gets called early enough so that setting "AutoSend := true" actually takes effect.
FredS
Posts: 98
Joined: Mon May 11, 2015 9:42 pm

Re: How to customize Assitants using Exception Filter?

Post by FredS »

madshi wrote:Then why should madExcept send the bug report? :) It only does that if you ask it to.

You can do "exceptIntf.AutoSend := true" to activate automatic sending. However, this needs to be set early enough. You seem to be using the madExcept VCL component to register your exception handler? Try manually calling RegisterExceptionHandler() instead, that will give you more control over how and when your handler will get calledl I'd suggest "epQuickFiltering" to make sure that your handler gets called early enough so that setting "AutoSend := true" actually takes effect.
See my edit to the last post.

In my real app I use: RegisterExceptionHandler, but in this simple app you can see nothing but the two lines you suggested are in the Handler.
Post Reply