|
<< Click to Display Table of Contents >> Navigation: 3. Script Language > AI - Artificial Intelligence Commands > AIG. - Google AI > B. Debugging and Errorhandling > AIG. - AI Google Gemini Integration |
MiniRobotLanguage (MRL)
AIG.GetError
Retrieve Last Error Details
Intention
Retrieves the specific error message, timestamp, and error code associated with the most recent failed AIG operation. This allows scripts to handle failures gracefully (e.g., by retrying a network timeout or prompting the user for a missing key).
It returns a detailed string from the internal g_aig_lastErrorMsg variable. If the last operation was successful, it returns "OK".
Format: [Date Time] [AIG:FunctionName] Error (Code): Message
The library uses a specific range (200-299) for its internal errors:
Code � �Description & Common Cause
200 INVALID_INPUT - A required parameter (like a JSON string or Prompt) was empty.
201 API_KEY_MISSING - You forgot to call AIG.SetKey before sending a request.
202 ENDPOINT_MISSING - Internal configuration error (Base URL not set).
203 PAYLOAD_CREATION - Failed to build the JSON request (e.g. invalid characters in prompt).
204 HTTP_FAILED - Network error. Server unreachable, timeout (180s+), or no internet.
205 DECODE_FAILED - The server response could not be decoded (e.g. corrupted UTF-8).
206 JSON_PARSE_FAILED - The Google API returned invalid JSON (or an HTML error page).
207 ANALYSIS_FAILED - The JSON was valid, but didn't contain the expected answer (e.g. empty candidate list).
208 API_ERROR_RESPONSE - Google returned a specific error (e.g., "Model not found", "Safety block", "Quota exceeded").
209 FILE_WRITE_FAILED - Could not save the response to disk (Permission denied / path invalid).
210 BASE64_DECODE_FAILED - Failed to decode an image returned by the API.
211 MISSING_REQUIRED_PARAM - e.g., calling AskVision without a MIME type.
212 UNSUPPORTED_FEATURE - Trying to use a feature not available in the current model.
299 UNEXPECTED_STATE - General internal error catch-all.
AIG.Ask|What is the capital of Mars?
' Check if result is empty (indicating error)
IVV.$$RET=""
' Retrieve details
AIG.GetError|$$ERR
DBP.Request Failed: $$ERR
' Output example:
' "[12:00:00] [AIG:CallAPI] Error (204): HTTP Transport Failed..."
EIF.
Syntax
AIG.GetError[|P1]
AIG.ger[|P1]
Parameter Explanation
P1 - (Optional) Variable name to store the error message. If omitted, the result is placed on the Top-Of-Stack (TOS).
See also: