Skip to content

Instantly share code, notes, and snippets.

@hurrifan1
Created March 14, 2022 19:26
Show Gist options
  • Save hurrifan1/46bc35d2b785fc8f1e21d49e361acb33 to your computer and use it in GitHub Desktop.
Save hurrifan1/46bc35d2b785fc8f1e21d49e361acb33 to your computer and use it in GitHub Desktop.
/* REST error retry loop */
/* - This script will try to execute a subroutine 3 times before it finally fails. */
Set ErrorMode = 0;
SUB MySub
LIB CONNECT TO 'Server test';
[MyTable]:
SQL SELECT
"image",
"theme",
"username"
FROM JSON (wrap on) "root";
END SUB
Set ScriptErrorCount = 0;
Call MySub
DO UNTIL $(ScriptErrorCount) = 0
Let currError = $(ScriptErrorCount);
Trace % % % % ERROR CODE MySub #$(ScriptErrorCount): $(ScriptError);
Sleep 3000;
Call MySub
if $(ScriptErrorCount) = 2 then; Set ErrorMode = 1; end if;
Let vMath = $(ScriptErrorCount) - 1;
Exit Do UNLESS $(currError) = $(vMath);
LOOP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment