Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
TRY CATCH ENDTRY and COM Server
Message
 
 
To
22/07/2003 06:10:55
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00812266
Message ID:
00812312
Views:
16
Try
cMessage = EVAL(cFunction)
>Hello everybody
>
>I have problems catching errors in a COM ole public server object instantiated in an ASP page. The COM server has a method called “KDPAction”, its have the functionality of execute specific functions in a procedure file determined for the received parameters, the code for the KDPAction method is as follow.
>
>LPARAMETERS cAction as string, cXML as String, cFileIni as String
>
>LOCAL I as Integer, cScript as String, cProcedure as String, cFunction as String,;
>	cMessage as String
>
>TRY
>	This.KDPScripts = ADDBS(This.ReadFileIni(cFileIni,"DIRECTORY","SCRIPTS"))
>	This.KDPSysDB = ADDBS(This.ReadFileIni(cFileIni,"DIRECTORY","SYSDB"))
>	This.KDPStyles = this.ReadFileIni(cFileIni,"DIRECTORY","Styles")
>	cMessage = ''
>	FOR I = 1 TO GETWORDCOUNT(cAction,",")
>		cScript 	= LOWER(GETWORDNUM(cAction,I))
>		cProcedure 	= LOWER(ALLTRIM(STREXTRACT(cScript,"","(")))
>		cFunction 	= ALLTRIM(STREXTRACT(cScript,"(",")")) + [(cXML,cFileIni)]
>		this.lError = .F.
>		cMessage = This.Scriptcontrols(cProcedure)
>		IF NOT EMPTY(cMessage)
>			RETURN cMessage
>		ENDIF
>		IF NOT cProcedure + ".fxp" $ LOWER(SET("Procedure"))
>			SET PROCEDURE TO (This.kdpscripts + cProcedure + ".fxp") ADDITIVE
>		ENDIF
>		cMessage = &cFunction  && called function
>	ENDFOR
>CATCH TO oError
>	this.lError = .T.
>	cMessage = THIS.Error(oError.ErrorNo, oError.Procedure, oError.LineNo)
>ENDTRY
>IF EMPTY(cMessage) OR VARTYPE(cMessage) = "L"
>	RETURN ""
>ELSE
>	RETURN cMessage
>ENDIF
>
>For the same object, the code for the “Error” method is
<snip>
>When I debug the source code the TRY ENDTRY structure trap correctly the errors originated for my functions in the procedure file, but, when I compile my COM server the error returned is always the same “Syntax Error” ad the line where I invoke the function throw the use of the macro substitution.
>
>The singularity of this problem is that when I invoke the function directly (cMessage = fAction(cXML,cFileIni) without the use of macro substitution the error is captured correctly, but when I compile, the compiler ask me where found the function “fAction” to follow the compilation, obviously, I indicate the procedure file where it is.
>
>My concrete question is how resolve the problems indicated without lose the parametric profile of my method.
>
>Thanks in advance for any help that the community can bring me.
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform