Nice post that explains hoew to manage exceptions in X++ : https://learn.microsoft.com/en-us/dynamics365/fin-ops-core/dev-itpro/dev-ref/xpp-exceptions
Category: Error exceptions
AX / D365FO – Generate an exception with an error message in X++
To generate an exception in X++ code and give a feedback to the user with an error message just use throw Error('Your error message') Here is an example boolean isOk = false; if (!isOK) { throw Error('Operation canceled'); } The code will stop after the exception and a red message will be shown to the … Continue reading AX / D365FO – Generate an exception with an error message in X++
AX -D365FO – Catch Exceptions Thrown from CLR Objects
In Microsoft Dynamics AX, when your X++ code calls .NET framework methods it is important that your code be designed to handle exceptions. When your code catches exceptions it can relay valuable diagnostic information to the user. The following X++ code sample demonstrates how to handle exceptions that are thrown from .NET methods // X++ … Continue reading AX -D365FO – Catch Exceptions Thrown from CLR Objects