Hi MS Pros!
Have been bugged by this error stated in the subject line and thought that a simple try catch will do the trick but i am unable to catch the exception as it terminates the code rather than go to the usual Catch block.
I have tried all exception enums including the general exception catch (by not declaring any exception enums) but still unable to catch the error.
This is happening in an AX2009 environment and a fully customised batch job. I have traced the error is due to BOM Circularity and i do realise that we just troubleshoot the error and handled it but when i add a BOM Circularity check on the ItemIDs then the batch job will subsequently have performance issues.
So the question is, how do i handle such exceptions (attached pic exception2)
also found a sample code online to force an exception but it is not catching as well
static void forceexception(Args _args)
{
Date date1,date2,date3;
int dateDiff;
;
try
{
date1 = mkdate(01,01,2013);
date2 = mkdate(10,01,2013);
date3 = mkDate(15,01,2013);
dateDiff = date3 - date2;
info(strfmt("Date diff is: %1", dateDiff)); //dateDiff = 5
date1 += dateDiff; //This works (You can only add positive integers, or subtract positive integers)
info(strfmt("New date is: %1", date1));
dateDiff = date2 - date3;
info(strfmt("Date diff is: %1", dateDiff)); //dateDiff = -5
date1 += dateDiff; //Runtime error: Error executing code: Wrong type of argument for conversion function.
info(strfmt("New date is: %1", date1));
}
catch
{
error('test');
}
}
this test script above does not reach the catch exception as per image below, regardless of exception enum (ie: Exception::error, exception::internal, etc).
Appreciate the help. if this is a limitation can someone please confirm so we can raise this with MS.
Many thanks,
Reynaldo
*This post is locked for comments
I have the same question (0)

Report
All responses (
Answers (