It is easy to feel frustrated and miserable when you make mistakes. But you can always learn from your mistakes and failures. If you use them as learning experiences, you can view them as positive. Although you would rather not have made those mistakes, you can now view them as stepping stones to growth.
When Rabbi Rephael of Bershid made a mistake in public, he felt very happy. He would view it as an opportunity to prevent him from becoming arrogant. During prayers in the synagogue, he once loudly read the wrong passage. Whereas most people would have felt very embarrassed, he viewed it as a fortunate occurrence. ~ Midrash Pinchas as quoted by R’ Zellig Pliskin