GET_LAST_ERROR
Return the last CURL error as a string.
GET_LAST_ERROR(
Error)
Parameters
Parameter |
Type |
Direction |
Description |
---|---|---|---|
Error |
String |
OUT |
Returned error string from CURL |
Return Values
Value |
Meaning |
---|---|
|
Success |
|
An internal error occurred |
Use
Can be used after the SEND operation.
Description
The GET_LAST_ERROR operation allows you to troubleshoot the SEND operation in case it returns the error -12 ("Internal error")
. Otherwise, the calling program does not know what the -12
means.
GET_LAST_ERROR returns the last CURL error caused by the previous SEND operation. It contains the actual error information. For a full list of CURL error codes, see libcurl error codes.
Errors are returned with the syntax:
CurlErrorCode = CurlErrorText
For example, if UHTTP.SEND returns the error -12
because the required SSL certificates are not available, calling GET_LAST_ERROR returns the following:
77 = Problem with the SSL CA cert (path? access rights?)
You can split the returned error string and format it as required. For example:
activate "UHTTP".GET_LAST_ERROR(Error) errorCode = $idpart(Error) errorText = $valuepart(Error) message/error $concat("UHTTP.SEND returned the curl error ", errorCode, " - ", errorText)
If no CURL error is set, GET_LAST_ERROR returns an empty string.