The way you frame a failure can make you feel better in the present and more likely to be successful (and happy) in the future.