Frustration does not make for good training. If you are working on a new behavior or trying to advance a known behavior and it is not going well then stop. Take a breath. Look at the dog's body language. Are the ears going back, eyes showing whites, is their lip licking? Is he tensing up? If so then its time to take a break. He is frustrated at not understanding what you want and he knows you are frustrated with what he is giving you. Ask for a well known command, usually a sit or focus, and end the session. Start fresh tomorrow when you are both in a better place.