I think of life as a series of small experiments. When you frame it that way, you are not devastated by failures. Some experiments succeed and others fail. You don’t have to stress too much about the outcome. Whether they fail or succeed, you always gain a bit, because you learn something.
I think I have had more failures in my life than successes. But a few successes more than wiped out most failures. The rest were swallowed by time.
It is not a happy ending, though (as happens in some movies). I am still living with the psychological effects of some of those failures.