John Keats said this quote

Failure ... is in a sense the highway to success inasmuch as every discovery of what is false leads us to seek earnestly after what is true and every fresh experience points out some form of error which we shall afterward carefully avoid.