When teens fail, reframe it as a normal part of life that teaches us how not to behave in the future. Don't make a huge personal issue of it. Stay focused on solutions. Work on those solutions together, or at least, be a strong cheerleader for your teen as he or she works on them. I know this doesn't seem like a big secret but many parents make some of their biggest errors here.
Teens are awkward, clumsy, anxious, and unskilled.
They have more experience as a child then as an adult. When they are in trouble they will draw on childish ways more often than adult ways because they are more familiar with childish ways. The challenge is to keep from overreacting to their behaviors and teach them the skills necessary to overcome failures. As we have said before, spent time with them, discuss rules and values, and model skills. Most importantly be patient with them.