Skip to content

LastError - cJsonHttpTransfer

Used to report an error after a failed JSON http transfer

Type: Procedure

Syntax

Procedure LastError

Call Example

Send LastError

Description

If a JSON/HTTP request fails, the return JSON handle will be 0 and peJsonTransferStatus will contain a status code.

Note that an error is not automatically generated. It is expected that you will want to check peJsonTransferStatus after your request and handle any failures in your code. If you wish, you can send LastError to generate an error.

Calling LastError after a transfer will generate an error message explaining how the transfer failed. If no error occurred, LastError will do nothing.

Get HttpPostJson of oJsonHttpTransfer sHost sFilePath hoJsonRequest (&bOk) to hoJsonResponse
If (hoJsonResponse=0) Begin // if no data came back, probably and error
    Get peJsonTransferStatus of hoHttp to eStatus
    If (eStatus<>jtsOk) Begin       
        Send LastError of hoHttp 
    End
End

See Also

TransferErrorDescription