How did you handle yourself when you realized it?
Did you continue to berate yourself further or did you gently say to yourself "we need to have a little chat you and I?"
We can only beat ourselves up if we allow it.
Put yourself in a time-out the next time you catch yourself beating you up.
Be gentle with you eh?