HTP. - HTTP Operations

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > Internet and Network > HTP. - Command > !HTP-General - General HTTP operations and utilities > !Request-Management - Commands for preparing, executing, and inspecting HTTP requests >

HTP. - HTTP Operations

HTP.GetErr

Previous Top Next


SPR Script Language

 

HTP.GetErr

Retrieves the last HTTP error code as a string.

 

Intention

 

The HTP.GetErr command in SPR fetches the error code of the most recent HTTP operation as a string, optionally storing it in a variable ($$RET). This allows scripts to check the status of HTTP requests (e.g., from HTP.Request) and respond to errors like timeouts or connection failures.

 

It’s your robot’s error detective—HTP.GetErr reveals what went wrong with the last HTTP call.

 

Illustration

🚨 Error Check: HTP.GetErr|$$ERR stores the last error code in $$ERR.
🔍 Inspect: Use it to debug HTTP issues!

 

Syntax

 

HTP.GetErr[|$$RET]

 

Parameter Explanation

 

P1 - $$RET - (Variable, String, Optional)

The variable to store the error code as a string (e.g., $$RET). If omitted, the error code is returned but not stored.

 

Examples

 

'***********************************

' HTP.GetErr - Sample 1: Check Error After Request

'***********************************

HTP.Request|GET|https://badurl|||0|0|0|$$RES

HTP.GetErr|$$ERR

MBX.Last Error: $$ERR (e.g., "12007")

MBX.Ready

'

'***********************************

' HTP.GetErr - Sample 2: No Output Variable

'***********************************

HTP.Request|GET|https://timeout|||0|0|0|$$RES

HTP.GetErr

' Error retrieved but not stored

MBX.Ready

'

 

Remarks

 

- Returns the last HTTP error code as a string (e.g., "12002" for timeout).

- Use with HTP.GetErrText to get a human-readable description.

- Typically used after HTTP commands to check for errors.

 

Limitations

 

- Returns only the last error; earlier errors are not accessible.

- Format depends on HTP_GetError; typically a numeric code.

 

See also:

 

HTP.ClrErr

HTP.GetErrText