Use of Try when program catch the error
Use of Throw to show our own exceptions
Exception throw within try block
see below example describe use of try,throw and exception on deadlock
public void delete()
{
#OCCRetryCount
try
{
ttsbegin;
if (this.isApproved() && RouteParameters::find().BlockEditing)
throw error("@SYS95153");
super();
this.updateCheckFlag();
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