In law school we learned how to "frame" the facts to make a winning argument. This basically this requires viewing things from a different point of view. The framing of facts, however, is not limited to the practice of law. In fact, how you frame (or view) "success" and "failure" is an essential element in achieving happiness and success in life.
The New York Times has an article on about a man whose son, Sam, was so uncoordinated that in elementary school he fell out of his chair if he tried to get something from his backpack. Sam grew up to play varsity football in high school — And lost every single game.
Still, Sam didn't feel bad at all. He played his best and that is all that mattered.
Psychologists who study the effects of optimism and pessimism will often try to help depressed patients "''reframe things' to see loss more positively. That might mean encouraging them to take pride in getting through an awful experience, or saying 'you didn’t fail, you found something that didn’t work.'"
Conclusion: Divorce is not failure. Through your marriage you learned about love, loss and negotiation. In the end, it didn't work out. You still have these skills. They'll be useful later on.