This is what I would do next. I would start at the top of the function and I would add
return 'This is a test';
I would return this value without checking anything to see if the code is called and got that far. Meaning you should always see the message for the field.
I would then move the return, alter the text so I was sure I was seeing the new message. I would keep moving it and testing until is stopped working.