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 :
Finance | Project Operations, Human Resources, ...
Unanswered

System.Exception catch

(0) ShareShare
ReportReport
Posted on by 465

Hi,

I thought system.Exception catches everything

So i had the following

Catch(Exception:Error)

{

  Here i return what is saved in sysInfoLog

Catch(ex) //this is system.Eception

{

   Info(ex.Message)

}

Catch{ i also return what is inside sysInfoLog}

Now what happened is, during inserting into logisiticsPostalAddressEntity.. An error occured that says countryRegionId should be filled

If there was no catch for the system exception, then the general catch will return this missage for me.(not sure why this wasn't catched by the error catch??? ) 

However when i added the system.Exception catch, the debug entered this catch. However it returned  nothing.

Does that mean that inside the ex catch, i should check if ex.Message==null then check the sysInfolog? But why it returned nothing? 

I have the same question (0)
  • huijij Profile Picture
    19,811 on at

    Hi sir,

    A direct throw of Exception::Error does not display a message in the Infolog. And the Global::error method is recommended.

    https://docs.microsoft.com/en-us/dynamicsax-2012/developer/exception-handling-with-try-and-catch-keywords#sample-2-error-method-to-write-exception-to-infolog

    regards

  • D365FO user Profile Picture
    465 on at

    Hi Judy,

    Thanks for that. But i'm not throwing errors, I'm catching them

    And my question was about system.Exception..it seems i should not print in the catch ex.Message i should check if it's null as well to display sysInfolog message because it seems sometimes  ex.message is empty even though the debug entered the catch 

  • Martin Dráb Profile Picture
    239,040 Most Valuable Professional on at

    Please use the debugger to check the type and properties of the exception. Then share the information with us.

    By the way, please always use Insert > Insert Code to paste source code here. It makes code easier to read, e.g. it prevents the double line spacing. This is your code posted in the right way (I also fixed letter case at a few places):

    catch (Exception:Error)
    {
    	...
    } 
    catch (ex) // this is System.Exception
    {
       info(ex.Message)
    }

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!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 658

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 468 Super User 2026 Season 1

#3
Syed Haris Shah Profile Picture

Syed Haris Shah 333 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans