AIG. - AI Google Gemini Integration

<< 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

AIG.ClearError

Previous Top Next


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.

 

What is the ClearError Command?

 

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.

 

Why Do You Need It?

 

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.

 

Example Usage

 

: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:

 

? AIG.GetError

? AIG.GetErrorHistory