Even Evils, Through God's Mercy, are of Use
He asserts that “no evil is the cause of anything good;” as if punishment, forsooth, were good, although thereby many have been reformed. There are, then, evils which are of use by the wondrous mercy of God. Did that man experience some good thing, when he said, “You hid Your face from me, and I was troubled?” Certainly not; and yet this very trouble was to him in a certain manner a remedy against his pride. For he had said in his prosperity, “I shall never be moved;” and so was ascribing to himself what he was receiving from the Lord. “For what had he that he did not receive?” It had, therefore, become necessary to show him whence he had received, that he might receive in humility what he had lost in pride. Accordingly, he says, “In Your good pleasure, O Lord, You added strength to my beauty.” In this abundance of mine I once used to say, “I shall not be moved;” whereas it all came from You, not from myself. Then at last You turned away Your face from me, and I became troubled.
Source: On Nature and Grace (New Advent)