Question

Is it possible to have the exception detail of an exception raised in AX? What I am trying to do is to emulate the behaviour of the exceptions in C#.

I am working with AX, so an AX related exception would be great, but even taking the most general exception would be much better than no error text.

Était-ce utile?

La solution

When AX throws an error it is of type Exception. This is an enum with a number of different types which are listed here: http://msdn.microsoft.com/en-us/library/exception.aspx. This is pretty much all the info you get. The error message is in the infolog, but there is no relation to the exception.

Quote from http://msdn.microsoft.com/en-us/library/cc967369.aspx:

In X++ the message that is created when an exception is raised is available only in the Infolog, and the message is not directly tied to the exception. In C# the message is the Message member of the System.Exception object.

You can however catch the different kinds of exceptions separately as demonstrated here: http://msdn.microsoft.com/en-us/library/aa893385.aspx

For exceptions coming from clr, you can get the inner exception with the message (see: http://daxmusings.codecrib.com/2013/04/exception-handling-in-dynamics-ax.html)

An extendable Exception class in AX would be great, who knows in future versions...

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top