Failure is not good.
There is absolutely nothing good about failure. And there's nothing you can pretend to learn from failure.
You can't learn anything from failure because don't forget that every single moment in your past has added up to that one moment in your present - where you are lying on the floor moaning your painful and abysmal failure.
Here are better things to learn from. Failure has many cousins. Learn from one of the cousins:
Curiosity: When something happens and you don't understand why, then ask, "Why?"Keep asking questions. Clearly, something confusing happened. Ask and ask and ask.Guess what will happen: you will get answers.
Persistence: I get asked: how do I market my book? Or my app? Answer: write another book. Write another app.
The best way to get better, to get more known, to learn the subtleties of your art or your field or your sport, is to simply do it again.
Forgiveness: I used to live in regret. One time I sold a business for $15 million. Within two years I had lost almost all of the money.
And it wasn't money on paper. It was money in "real life". If I tell you how I lost it you would hate me forever. That's ok. But it's not important for this answer.
"Failure" is a word used to label a past event. That's 100% up to you how you label a past event.
When you label a past event "failure" it prevents you from moving beyond the past. You get stuck there. You keep time traveling to the moment of failure under the excuse that there is something to learn there.
The thing you learn first is forgiveness. Then you move back to the present. Get healthy. Be around people you love. Start being creative again.