Exceptions handling in axapta


 static void Intro_TryCatch(Args _args)  
 {  
 Counter counter;  
 try  
 {  
 while (counter < 10)  
 {  
 counter++;  
 if (counter MOD 7 == 0)  
 throw error("Counter MOD 7 is zero");  
 if (counter MOD 3 == 0)  
 throw warning("Counter MOD 3 is zero");  
 }  
 }  
 catch (Exception::Error)  
 {  
 print ( strfmt("An error appeared at loop %1", counter));  
 }  
 catch (Exception::Warning)  
 {  
 print ( strfmt("A warning appeared at loop %1", counter));  
 retry;  
 }  
 pause;  
 }