web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Unhandled exception even when having try catch statement

(0) ShareShare
ReportReport
Posted on by

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.."
}


*This post is locked for comments

I have the same question (0)
  • Verified answer
    Community Member Profile Picture
    on at

    Okay, I just found out that this has something to do with my positioning of ttsbegin and ttscommit, and I've solved it out.

    Could the mod please delete this thread, thanks in advance.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans