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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Why try catch

(0) ShareShare
ReportReport
Posted on by

HI guys ,

I am little bit confused that ,

If I can do normal coding & with this functionality is working properly, then why we should use try catch in our methods.

your suggestions will be appreciated.

Thanks

*This post is locked for comments

I have the same question (0)
  • André Arnaud de Calavon Profile Picture
    303,691 Super User 2026 Season 1 on at

    Hi Mayur,

    With the try/catch you can capture errors and do specific actions with them. Usually the coding will just do what it needs to do.

    If you are using an external referenced dll, it might not be installed on the client, you can capture it and present a friendly message, the dll is missing in the installation.

    Or for long running tasks, you can capture e.g. a database lock and do a retry.

  • Dauvis Profile Picture
    170 on at

    The try/catch block are used to catch exceptions so that you can gracefully handle them.  The most common exceptions are the ones for dead lock and update conflict.  One way to use them is to have one that wraps a process or an atomic step in the process (the block will catch the errors in any methods that get called).

    I would like to add that the rules get a bit fuzzy when combining a try/catch with transactions (ttsBegin/ttsCommit).  Any exceptions will cause the whole transaction to be rolled back.  For more info: blogs.msdn.com/.../exception-handling-and-transactions.aspx

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Joris dG Profile Picture

Joris dG 5

#2
Alexey Lekanov Profile Picture

Alexey Lekanov 2

#2
Henrik Nordlöf Profile Picture

Henrik Nordlöf 2 User Group Leader

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans