From Tynan’s Training Yourself (emphasis added)

What happens if you fail? The absolute most important thing is that you don’t use it as an excuse to stop training. If you do this EVER, your brain will figure out that all it has to do is sabotage you once, and then you don’t have to do the challenging new behavior To counteract this, I punish myself by making myself do more the next day. This isn’t a punishment meant to make myself feel bad, it’s just a method of making my brain sabotage-resistant.

If I mess up I don’t get down on myself, either. I note the error, think about what it will take to not make the error again, think about how well I’m doing overall, and focus on the importance of knocking it out of the park the next day to keep momentum up.