|
<< 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.ClearError
Reset Internal Error Flags and Logs
Intention
To reset the library's error state to "Success" (OK). This is crucial when implementing retry logic or error recovery loops, ensuring that previous failures do not interfere with subsequent checks.
This command sets the internal global variable g_aig_lastError back to 0 (NO_ERROR) and clears the last error message string. Optionally, it can also wipe the entire cumulative error history log.
�Retry Loops: If an API call fails (e.g., Timeout), you handle it, wait, and try again. You must clear the error so the code doesn't think the retry failed immediately.
�Memory Management: If your robot runs for days, the Error History log can grow. Clearing it periodically frees up memory.
:RetryLabel
AIG.Ask|Is the internet working?
' Check if command failed
IVV.$$RET=
DBP. Error detected. Waiting to retry...
PAU.5
' Reset error state before retrying
AIG.ClearError
GOTO RetryLabel
EIF.
' Clear everything including history log
AIG.ClearError|1
Syntax
AIG.ClearError[|P1]
AIG.cer[|P1]
Parameter Explanation
P1 - (Optional) Integer flag.
�0 (or omitted): Clears only the current Last Error state.
�1: Clears the Last Error AND wipes the entire Error History log.
See also: