General X++ Development
How do I get the exception message in X++?
How do I get the exception message in X++?
1 answer
Write an answerFor normal X++ errors, the useful message is often already in the Infolog.
For CLR exceptions:
catch (Exception::CLRError)
{
System.Exception ex = CLRInterop::getLastException();
error(ex ? ex.get_Message() : 'CLR error.');
}Do not replace a useful exception with something like "An error occurred." If you are handling the exception, keep enough detail to actually troubleshoot it.
Know the solution?
Sign in to contribute an answer and build your community reputation.
Sign in to answer