
Hi
I have some x++ code using to create a sales order with the sales line. Every now and then I get an error creating the dales line and it believe it probably missing data or an inaccurate use of an inventory dimension. I want to be able to surround the create line operation in a try catch and capture the error as string so I can store or report in another process. How do I extract the error message from Exception::Error
Eg
try
{
salesLine.createLine();
}
catch(Exception::Error)
{
//What do I o here to extract the error
}
str error;
try
{
// ...
}
catch (Exception::Error)
{
enumerator = SysInfologEnumerator::newData(infolog.cut());
while (enumerator.moveNext())
{
strc = new SysInfologMessageStruct(enumerator.currentMessage());
exception = enumerator.currentException();
error = strfmt('%1 %2', error, strc.message());
}
}
catch (Exception::CLRError)
{
netExcepn = CLRInterop::getLastException();
error = netExcepn.ToString());
}