To help them realize that setbacks are a natural side-effect of trying to achieve higher goals, not character flaws, or a judgment of who they are!
It comes down to this - great parenting is just as much an acquired skill as anything else.