GetErrorCode Method
Class: FTP_SERVICE
Description:Watch dog of this FTP Service
This method is the watch dog of this FTP Service. After every FTP function is performed, return codes, error codes and messages are stored internally. This method retrieves the last error code generated by a FTP function call.

Extended error codes and messages are generated during each API call. This extended information is also stored after each function call.

If llShowMessage is set to .T., a message box will be displayed showing the last error code with the text relating to that error code. Also the extended error code and message is displayed.

Most of the time, the FTP_SERVICE::nResult_Code will be 0 if the function succeded.

In some cases, the FTP_SERVICE::nResult_Code will be different than 0 if the function succeded. For example, this method returns ERROR_NO_MORE_FILES after the function FTP_SERVICE::GetFTPDirectoryArray() succeds. So it is important to check to see if the function succeded and then check the error codes.

=
Object.GetErrorCode
Parameter
llShowMessage
Show message?
Type Boolean
Direction Input
Set to .T. to display a MessageBox on the screen.
Return value Numeric
Returns the error code from the last FTP function as a numeric value.
Example
LOCAL loFTP,lcPom #INCLUDE "ftp.h" SET PROCEDURE TO ftp.prg ADDITIVE loFTP=CREATEOBJECT('ftp_service') IF loFTP.OpenInternet("ABONNE", "PWD", "10.10.10.10", "21") IF !loFTP.ChangeFTPDirectory("_!_"+CHR(1)+CHR(9)) loFTP.GetErrorCode(.T.) ENDIF =loFTP.CloseInternet() ENDIF RELEASE PROCEDURE ftp.prg
See also
Expand/Collapse source code of procedure GetErrorCode Source Code
      LPARAMETERS INP llShowMessage
      LOCAL lcMessage
      IF m.llShowMessage
         * Build Error Message Here
         lcMessage = "Error (" + ALLTRIM(STR(This.nResult_Code)) + ")  -  " + ;
                     This.GetErrorText(This.nResult_Code)
         IF !EMPTY(This.cExtended_Message)
            lcMessage = m.lcMessage + CHR(13) + CHR(13) + "Extended Error Info - (" + ;
                        ALLTRIM(STR(This.nExtended_Result)) + ;
                        ") - " + This.cExtended_Message
         ENDIF
         =MESSAGEBOX(m.lcMessage, 48, "FTP Error Message")
      ENDIF
      RETURN This.nResult_Code