Exception handling is important when we write code. Below is the sample code to catch exception when code is running.
class TryCatchTest
{
SysInfologEnumerator enumerator;
SysInfologMessageStruct msgStruct;
Exception exception;
Counter i = 0;
str errorGlobal;
public void createCustomer()
{
CustTable custTable;
try
{
custTable.AccountNum = "Account1";
custTable.insert();
}
catch
{
++i;
enumerator = SysInfologEnumerator::newData(infolog.cut(i));
while (enumerator.moveNext())
{
msgStruct = new SysInfologMessageStruct(enumerator.currentMessage());
exception = enumerator.currentException();
errorGlobal += msgStruct.message();
}
}
}
}
No comments:
Post a Comment