Is an action (process, event, situation, relationship, result) a "waste" of time or a "failure" if you learn something or gain something different than you expected? As Oprah famously says, "When you know better, you do better."
I believe it is largely a matter of perspective. For example: Did I waste 20+ years on my ex-husband? We are divorced, but I traveled, went to college, found a career, and grew as a person. Should I discount all that because the marriage failed?
Experience is the best teacher and "failing" is part of that. Failing may, in fact, save you from something worse.