Code for "What's Wrong"

Hello,

I have inculded the code to remove the errors (like mate failure) in my assembly that is code for the "What's wrong" but it throws some unexpected error. Can any body tell me how to resolve this, I am attaching the error and code what we have written for mate failed issue.

Thanks & Regards

Shrinivas Jayphalkar

SolidworksApi macros