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)

ax 2009 - best practice for try+catch block

(0) ShareShare
ReportReport
Posted on by

Hello,

I have try + catch block.

The catch should be empty - what is the best practice way doing that?

try {

// my code ...

} catch {

// do nothing.

}

Thanks :)

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    StevenK Profile Picture
    on at

    Well having an empty catch statement wouldn't be best practice, but if you're going to do it then

    try

    {

     // do something

    }

    catch

    {}

  • Community Member Profile Picture
    on at

    Well - this is not best practice.

    I know that there is a way putting something instead of {} - I just forgot that ...

    What shall I put instead of catch {} ?

    Thanks :)

  • Suggested answer
    Daniel Weichsel Profile Picture
    on at

    The best practice is to call exceptionTextFallThrough() in the catch block -- and of course document the reason why nothing is done.

  • PopCola Profile Picture
    5 on at

    Hi, I'm currently migrating to X++ language from other .net PL. I'm kinda curious if the "finally" block is also available in X++. Is it? Thanks!

  • Suggested answer
    Community Member Profile Picture
    on at

    Hi POPCOLA,

    There is no finally statement in X++.

    Please review following link

    msdn.microsoft.com/.../aa893385.aspx

    Please verify, and let us know your findings

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