Intraweb

delphi package - automated exception handling
Post Reply
etwoss
Posts: 23
Joined: Thu Aug 04, 2016 11:45 am

Intraweb

Post by etwoss »

Hi

I'm new to madExcept. Adding it to a VCL app was simple.
But i really want it to work in IntraWeb.

Are there any specific things to notice with IntraWeb?

I think i should NOT uses ServerController.OnBaseException or, if used, re-raise the error?

Anything special for Standalone Server and/or ISAPI.DLL?


I created a very simple INtraweb app with 1 form and 1 Button with code:

Code: Select all

var
  i, j : double;
begin

  i := 10;
  j := 0;
  i := i/j;
end
So division by zero.

When i run (outside the ide) i get a popup telling me about the division by zero but no report

Code: Select all

[GeneralSettings]
MesVersion=4
HandleExceptions=1
LinkInCode=1
AppendMapFileToBinary=1
NoOwnMadExceptSettings=0
CheckFileCrc=1
CheckForFrozenMainThread=0
FreezeTimeout=60000
ReportLeaks=0
WindowsLogo=0
CrashOnBuffer=0
CrashOnUnderrun=0
AutomaticallySaveBugReport=1
AutoSaveBugReportIfNotSent=0
AutomaticallyMailBugReport=0
AutoMailProgressBox=0
CopyBugReportToClipboard=1
SuspendAllRunningThreads=0
ShowPleaseWaitBox=1
PleaseWaitIcon=plwait1
AutomaticallyContinueApplication=0
AutomaticallyRestartApplication=0
AutomaticallyCloseApplication=0
SendInBackground=1
SendHelper=196608
Send32Icon=send321
UploadViaHttp=0
HttpServer=
HttpSsl=0
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=1
MailViaMailto=1
MailAddress=
BugReportFile=c:\temp\bugreport.txt
AttachBugReport=1
AttachBugReportFile=1
DeleteBugReportFile=1
BugReportSendAs=bugreport.txt
BugReportZip=
ScreenShotDepth=8
ScreenShotAppOnly=0
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=0
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=EDBEditError
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: 10753
Joined: Sun Mar 21, 2004 5:25 pm

Re: Intraweb

Post by madshi »

Ouch, ISAPI is always making my head hurt.

Have you tried adding "madIWSupport" to your uses clause? In theory madExcept is supposed to automatically detect Intraweb projects and automatically add "madIWSupport" to the project's uses clause for you, but maybe the detection doesn't always work correctly, I'm not sure.

The last time I tested Intraweb was years ago. I don't know, maybe something has changed since then which has broken madExcept's IW support?

Generally, there are 2 kinds of exceptions: Those that occur inside of a client request. Those are supposed to be reported back to the client as an Intraweb exception form shown in the browser. And then there are those exceptions which occur in Intraweb code on the server, without any context to a specific client request. Such exceptions should show a crash box on the server side. You probably don't want a crash box on the server side, so you could disable that and instead of activate automatic bug report sending.
etwoss
Posts: 23
Joined: Thu Aug 04, 2016 11:45 am

Re: Intraweb

Post by etwoss »

Hi

When i Add madIWSupport to the project in the uses clause, and compile, the entry is removed!

Normal stand alone EXE from IntraWeb

Eric
madshi
Site Admin
Posts: 10753
Joined: Sun Mar 21, 2004 5:25 pm

Re: Intraweb

Post by madshi »

The removing should be disabled if you add a comment "// dontTouchUses" right above the project's uses clause. Does that help in any way?
etwoss
Posts: 23
Joined: Thu Aug 04, 2016 11:45 am

Re: Intraweb

Post by etwoss »

Hi

yes this helps! What kind of Voodoo is this? :-)

Eric
madshi
Site Admin
Posts: 10753
Joined: Sun Mar 21, 2004 5:25 pm

Re: Intraweb

Post by madshi »

Does it just help not getting the unit removed? Or does it also make exception handling in your IntraWeb app work correctly?
etwoss
Posts: 23
Joined: Thu Aug 04, 2016 11:45 am

Re: Intraweb

Post by etwoss »

Hi

Both! Thanks for your help.

One more question: we use our application on our own services but also on the server of a customer.
On the last one we want other settings . Can i manipulate settings in code?

Eric

PS

Are the settings compiled into the app?
madshi
Site Admin
Posts: 10753
Joined: Sun Mar 21, 2004 5:25 pm

Re: Intraweb

Post by madshi »

Oh, I'm glad to hear that! :D

The madExcept settings are stored in the resource section of your EXE file.

But yes, you can change the settings at runtime. See here:

http://help.madshi.net/MESettings.htm
etwoss
Posts: 23
Joined: Thu Aug 04, 2016 11:45 am

Re: Intraweb

Post by etwoss »

Hi

Intraweb has it's own exception handling im the ServerController class (OnBaseException handler), i noticed that the method OnBaseException is not called anymore.

Eric
madshi
Site Admin
Posts: 10753
Joined: Sun Mar 21, 2004 5:25 pm

Re: Intraweb

Post by madshi »

I don't remember the details, it's been years since I looked into IntraWeb, but I expect that the "madIwSupport" unit probably "hacks" OnBaseException to activate madExcept's exception handling. If you want an exception callback, you can use madExcept's "RegisterExceptionHandler()" API.
etwoss
Posts: 23
Joined: Thu Aug 04, 2016 11:45 am

Re: Intraweb

Post by etwoss »

Hi

Great,

Any example of this?

Eric
etwoss
Posts: 23
Joined: Thu Aug 04, 2016 11:45 am

Re: Intraweb

Post by etwoss »

Found documentation :-)
etwoss
Posts: 23
Joined: Thu Aug 04, 2016 11:45 am

Re: Intraweb

Post by etwoss »

Hi

For some customers i have to completely disable madexcept

Enabled is read only property

How to do this?

Eric
madshi
Site Admin
Posts: 10753
Joined: Sun Mar 21, 2004 5:25 pm

Re: Intraweb

Post by madshi »

You can use PauseMadExcept(). It's not 100% disabled, but mostly.
Post Reply