Exception Handling in AX

Today I will demonstrate you that how to use Try, Catch, Throw and Retry keyword in AX.

Try-Catch-Retry-Throw
static void ExceptionHandling(Args _args)
{
try
{
info("Now I’m here");
if (true)
   throw error("Oops! Something happened");
info("Now I’m there");
}
catch (Exception::Error)
{
info ("I would like to inform you that an error occured ");
}
catch (Exception::Deadlock)
{
sleep(10000);
retry;
}
info ("This is the end");
}



Comments