Monday, December 30, 2013

Retry -Sample Code



Here's a sample code taken from the AX class which shows the no of times you want to execute your code in try and catch statement.


try
{
ttsbegin;
reqCalcForecastItem.run();
ttscommit;
} 
catch (Exception::Deadlock)
{
retry; 
} catch (Exception::UpdateConflict) 
{ 
if (appl.ttsLevel() == 0) 
{
if (xSession::currentRetryCount() >= #RetryNum) 
{ 
throw Exception::UpdateConflictNotRecovered;
}
else
{
retry;
}
} 
else
{
throw Exception::UpdateConflict;
}
}

No comments:

Post a Comment