Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
AFP
Message
General information
Forum:
Visual FoxPro
Category:
Internet applications
Title:
Re: AFP
Miscellaneous
Thread ID:
01419195
Message ID:
01419465
Views:
98
Hi Tuvia,

>I am replacing the error handler with my own (the red screen of death), and I was wondering before I reinvent the wheel if you or somebody out there had done an error handler for AFP that they would share.

There are multiple ways to handle errors... In my applications I usually used the error event in the afpa.code file:
Procedure EVENT_Error

	* Replace the dynamic parts of the error HTML and send by mail
	Local lcMail, lcFailed
	lcFailed = ""
	lcMail = Error.ErrorHtml()
	lcMail = Strtran( m.lcMail, "display:none", "" )
	Try
		SendEmail( ;
			m.lcMail, ;
			"App name: " + Error.cMessage, ;
			"Empfänger=rec@server.com" ;
		)
	Catch
		lcFailed = " (Modul k.FM)"
	EndTry

	* Display a generic error message
	Response.Clear()
	Server.Transfer( ;
		"error.afp?msg="+Server.URLEncode("Your request cannot be processed at this time. Please try again later."+m.lcFailed) ;
	)
	
	* Close files
	Close Databases
	Close Databases all
	
	* Cancel execution. Without CANCEL AFP would continue with the next line in the current page
	Cancel
	
EndProc
SendEMail is a function in my utility library. It uses BLAT.DLL to send an error message.

>On a different note, I have often had trouble getting it to run properly as a service rather than an app.

Which server are you using? Which problem do you have? There's one know issue when you have Win2003, log onto the server via RDP and stop the service, the service would crash.
--
Christof
Previous
Reply
Map
View

Click here to load this message in the networking platform