We must understand that the practice is a simple game of attention - what you pay attention to will grow in your reality. If you react negatively to your mistakes, you are giving the mistakes more power because you are giving them more attention. Notice them, but don't react to them. Any negative reaction feeds them and gives them more power.
When you are playing well, your attention is on playing and listening. When you don't play as well, your attention is divided - you're paying attention to HOW you are playing the guitar, or how other people think you are playing the guitar, or what just happened in that passage, or what will happen in the upcoming passage, or any number of things. This mind activity takes power away from where the attention needs to be - playing and listening in the now. The zen story of the archer demonstrates this point very well.
When you notice your mind chattering - acknowledge it, and then bring it back to playing and listening. Every time you make a mistake, bring the mind back to playing and listening. Be courageous. Don't let any mistake distract you. The mistakes can only win by allowing them to bother you.
Keep focusing your attention on what you want to grow - not on what you don't want to grow. This is the practice. All else will fall into place with time.