Hi All,
I would like to call a method in a 'try' block in case an exception is thrown inside a transaction.
my code can be simplified as follows:
while (enumerator.moveNext())
{
try
{
ttsbegin;
...
purchLine.update()
ttscommit;
}
catch
{
infoLogEnum = SysInfoLogEnumerator::newData(infolog.infologData());
while(infoLogEnum.moveNext())
{
// currentException() returns you Exception enum and you can check if it is Exception::Error or Exception::Warning.
switch (infoLogEnum.currentException())
{
case Exception::Warning:
info(strFmt("[Error] PO:%1 %2",purchLine.PurchId,infoLogEnum.currentMessage()));
break;
}
}
}
}
I would like to include that call to another method within the tts begin- tts commit transaction block like below
while (enumerator.moveNext())
{
try
{
ttsbegin;
...
purchLine.update()
// here I would like to call another method before ttscommit
ttscommit;
}
catch
{
infoLogEnum = SysInfoLogEnumerator::newData(infolog.infologData());
while(infoLogEnum.moveNext())
{
// currentException() returns you Exception enum and you can check if it is Exception::Error or Exception::Warning.
switch (infoLogEnum.currentException())
{
case Exception::Warning:
info(strFmt("[Error] PO:%1 %2",purchLine.PurchId,infoLogEnum.currentMessage()));
break;
}
}
}
}
I tried to add that call right after purchline.update(), but then the infolog message is not shown to the user for a line with an error in case multiple lines are selected for update.
Thank you.