Question: preventing ERROR

The definition 
a:=ModularSquareRoot(10,11)
returns
Error, ... because no numbers in Z11 have the square equal to 10. I need, in a procedure, to prevent the error, I mean something like this:
if a<>ERROR then b:=b+1 else c:=c+1 end if
Any suggestions? Thanks

Please Wait...