Browse Prior Art Database

TRY block with Conditional Logic to control Retry Attempts Disclosure Number: IPCOM000035584D
Original Publication Date: 2005-Jan-25
Included in the Prior Art Database: 2005-Jan-25
Document File: 1 page(s) / 31K

Publishing Venue



Modern programming languages support the TRY/CATCH block for recovering from errors. However, it doesn't support the notion of fixing the error and then retrying the original block of code that failed. In order to do that the programmer would have to effectively repeat the code again within the CATCH block or wrap the TRY / CATCH block with a conditional control loop.

This text was extracted from a PDF file.
This is the abbreviated version, containing approximately 100% of the total text.

Page 1 of 1

TRY block with Conditional Logic to control Retry Attempts

Described is a behavioral enhancement to the TRY / CATCH block to allow one or more retry attempts to be performed on the original code. The behavioral change is in the additional conditional logic expression added to the TRY statement and the manipulation of conditions in the CATCH blocks.

With this behavior change the CATCH block could effectively fix an error and the TRY would be executed again unless the conditional logic expression evaluated to FALSE.

So now you have an implicit RETRY feature that is stopped via a conditional logic expression in a manner similar to a WHILE loop.

As an example:

TRY (iRetries<10) { if(x>100) throw BadXValueException; if (y>100) throw BadYValueException; rSquared = x*x + y*y; if(rSquared>1000000) throw TooBigException; }

CATCH (BadXValueException) { x=50; // implicit retry of TRY block iReties++; }

CATCH (BadXValueException) { x=50; // implicit retry of TRY block iRetries++; }

CATCH (TooBigException) { rSquared=1000000; break; //explicit termination of TRY block }


     ...called when there is no catch or retry count exhausted... }