5.22 How to catch an error from a proc()?

An error in maple raises an exception. So, use try catch to trap it as follows:

try 
   v,pos:=MMax(4); 
catch: 
   printf("an error is cought\n"); 
end try;