Quantcast
Channel: Microsoft Dynamics AX Forum - Recent Threads
Viewing all articles
Browse latest Browse all 72043

Unhandled exception even when having try catch statement

$
0
0

Hi all,

I have a try and catch statement. When an error appeared, the catch statement caught the error, without running the codes inside the catch block.

The code below tries to insert a record into PurchTable, only to have the system complainining an already existing PurchId in place.

Now, I am completely fine with having that error. I tried to handle that error with a catch statement beneath it, but it is not executing the code within the catch.

Could anyone please enlighten me?

Here is the code below:

try
{
    purchTable.insert(); //An already existing purchId exists in the PurchTable
}
catch //code was read by the compiler/ AX when I was stepped into inside debugging mode
{
    warning("Exception caught"); //code skipped because of "Unhandled exception: Multiple key blah blah.."
}



Viewing all articles
Browse latest Browse all 72043

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>