For every warning of judgement there is a message of hope and repentance. God wants us to turn from our sins and return to Him; He wants us to come before Him and say:
Have mercy upon me, O God, according to Your Lovingkindness; according to the multitude of Your tender mercies, blot out my transgressions. Wash me thoroughly from my iniquity and cleanse me from my sin. For I acknowledge my transgressions and my sin is always before me. Against You, You only, have I sinned and done this evil in Your sight – that you may be found just when You speak and blameless when You judge.
Behold, I was brought forth in iniquity and in my sin my mother conceived me. Behold, You desire truth in the inward parts and in the hidden part You will make me to know wisdom. Purge me with hyssop and I shall be clean; wash me, and I shall be whiter than snow. Make me hear joy and gladness, that the bones You have broken may rejoice. Hide Your face from my sins and blot out all my iniquities.
Create in me a clean heart, O God, and renew a steadfast spirit within me. Do not cast me away from Your presence and do not take Your Holy Spirit from me. Restore to me the joy of your presence and uphold me by Your generous Spirit. Then I will teach transgressors your ways and sinners shall be converted to You.
Open my lips, and my mouth shall show forth Your praise for you do not desire sacrifices, or I would give it; You do not delight in burnt offering. The sacrifices of God are a broken spirit, a broken and contrite heart – These, O God, You will not despise.
Taken from Psalm 51 (NKJV)