Showing posts with label HOW TO GET ERROR MESSAGE IN TRY CATCH. Show all posts
Showing posts with label HOW TO GET ERROR MESSAGE IN TRY CATCH. Show all posts

Friday, 11 October 2019

D365 try catch how to get exact error message


HOW TO GET ERROR MESSAGE IN TRY CATCH


System.Exception exception;
try
{

}
catch(Exception::CLRError)
{
exception = CLRInterop::getLastException();
while(exception)
{
error( exception.get_Message() );
exception = exception.get_InnerException();
}
throw Exception::Error;
}

NOTE: Code inside the catch statement will only get executed of the tts level is zero.
Thanks,
Vikas Mehta

Blog Post 6: Bonus – Building Your First Custom Copilot Plugin in X++

Blog Post 6: Bonus – Building Your First Custom Copilot Plugin in X++  Introduction In our previous posts, we explored what Copilot can do o...