Sometimes we manage to do what is right, lead a good and virtuous life, have great trust in God, without the slightest problem; and then a difficult time comes. For instance, we commit a fault that really humiliates us. Or we make a wrong decision, which is unpleasant, especially when other people notice it. We are brought face-to-face with our defects, and we become sad and discouraged. All our great trust in God melts away like snow in the sun.
This simply means that what we called trust in God was in fact trust in ourselves. If trust disappears when we do wrong, it shows that our trust was based on ourselves and our deeds. Discouragement is a clear sign that we've put our trust in ourselves and not at all in God.
... And it is vital that our trust should rest not on our personal achievements but only on God's love, his tenderness, his infinite mercy, on the fact that he is our Father and can never abandon us. Otherwise we will never be truly free but will always be afraid of failure, of our weaknesses and somewhat centered on ourselves instead of centered on God.
Jacques Phillipe,The Way of Trust and Love: A Retreat Guided by St. Therese of Lisieux