|
<< Click to Display Table of Contents >> Navigation: 3. Script Language > AI - Artificial Intelligence Commands > AIU. - OpenAI API > AIU. - Artificial Intelligence Utility |
AIU.Error Handling |
Previous Section Top |
MiniRobotLanguage (MRL)
AIU.Error Handling
Manage and retrieve error information from the AIU library.
Intention
The AIU library has its own dedicated error handling system, separate from the underlying HTP and JSW libraries. This allows you to specifically diagnose issues related to AI operations, such as a missing API key, a malformed payload, or an error response from the OpenAI API itself. These commands provide the tools to check for, retrieve, and clear error states within your scripts, enabling robust and reliable automation.
It’s your robot’s diagnostic panel—these commands let you see exactly what went wrong with an AI task, from a simple input mistake to a complex API failure, helping you debug your scripts and build resilient workflows.
Illustration
┌───────────────────────────┐
│ AIU.Chat|"Tell me a joke" │ (Fails: No API Key)
└─────────────┬─────────────┘
│
▼
┌───────────────────────────┐
│ AIU.GetLastError|$$ERR │ --> $$ERR = 101
│ AIU.GetLastErrorMsg|$$MSG │ --> $$MSG = "Error: API Key not set."
└───────────────────────────┘
Using error handling commands to diagnose a failed API call.
Commands in this Section
• AIU.GetLastError - Retrieves the last numeric error code.
• AIU.GetLastErrorMsg - Retrieves the last formatted error message string.
• AIU.GetErrorHistory - Retrieves the log of all errors from the current session.
• AIU.ClearError - Resets the last error status and can optionally clear the history.