Dismiss
InnovationQ will be updated on Sunday, Oct. 22, from 10am ET - noon. You may experience brief service interruptions during that time.
Browse Prior Art Database

TRY block with Loop Conditional Logic to Control Retry Attempts

IP.com Disclosure Number: IPCOM000035582D
Original Publication Date: 2005-Jan-25
Included in the Prior Art Database: 2005-Jan-25
Document File: 1 page(s) / 31K

Publishing Venue

IBM

Abstract

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 Loop 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 loop count is exhausted.

As an example:

TRY (int iRetries=0; iRetries<10; iRetries++) { 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 }

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

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

FINALLY {

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

1