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 ENDIFFor the same object, the code for the “Error” method is
LPARAMETERS nError, cMethod, nLine LOCAL cErrorMsg as String, cFile as String SET TEXTMERGE ON NOSHOW SET TEXTMERGE DELIMITERS TO <<,>> TEXT TO cErrorMsg ======> COM SERVER ERROR REPORT ON <<TRANSFORM(DATETIME())>> <========== CAPTURED SCRIPT ERROR INFORMATION ErrorNo: <<TRANSFORM(nError)>> Method: <<cMethod>><br> Line: <<TRANSFORM(nLine)>> ADDITIONAL INFORMATION FOUND FOR THE LAST VERIFIED ERROR ErrorNo: <<TRANSFORM(IIF(this.lError,oError.ErrorNo,nError))>> Program: <<IIF(this.lError,oError.Procedure,cMethod)>> Line: <<TRANSFORM(IIF(this.lError,oError.LineNo,nLine))>> Message: <<IIF(this.lError,oError.Message,MESSAGE())>> Source: <<IIF(this.lError,oError.LineContents,MESSAGE(1))>> ======> END OF ERROR REPORT <========== ENDTEXT SET TEXTMERGE OFF SET TEXTMERGE DELIMITERS * Append message error to log file "OM3ERROR.log" on SysDB directory cFile = This.KDPSysDB + "OM3ERROR.log" = STRTOFILE(cErrorMsg,cFile,1) * Populate COM error structure IF INLIST(_VFP.StartMode, 3, 5) COMRETURNERROR(_VFP.ServerName, cErrorMsg) ELSE RETURN cErrorMsg ENDIFWhen 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.