Rejoice always, pray without ceasing, give thanks in all circumstances; for this is the will of God in Christ Jesus for you. 1 Thessalonians 5:16-18 (ESV)
David confessed his sin, received forgiveness from God, and knew God could still use his life.
The bible presents the challenges and choices of Abraham when it came to trusting the promises of God, believing in hope, hoping against hope...
If we confess our sins, He is faithful and righteous to forgive us our sins and to cleanse us from all unrighteousness.