One of the take-aways from Joshua 7 is that when we surrender to the Lord and deal with the sin in our lives no defeat is permanent. There is no moral failure or mistake that cannot be remedied by the grace and mercy of God.
F.W. Robertson, the nineteenth-century British Bible teacher and scholar (the author of Robertson's New Testament Word Studies), taught for several years at Wake Forest University in North Carolina. In a sermon he preached once, he made a statement, which ties in beautifully with this concept. "Life, like war, is a series of mistakes, and he is not the best Christian nor the best general who make the fewest false steps… Forget mistakes; organize victories out of mistakes." Joshua would have agreed, because in chapter 8 he allows the Lord to organize the victory out of his mistakes and failures.
Once the nation of Israel judged the sin that had defiled their camp, then God was free to speak forgiveness, to extend mercy, and to direct them once again in the conquest of the land. That is how the Lord cares for us in our failure.
The Lord directs the steps of the godly. He delights in every detail of their lives. 24 Though they stumble, they will never fall, for the Lord holds them by the hand. (New Living Translation)
I hope you have a sense of how much God delights in you and in the path that you're following. We will fall, but the Lord is right there to pick us up. He delights in us even when we fail if we turn to him and ask him to restore us. That is the good news, no matter what mistakes we may have made. In a sense, the worst mistake we can make is to give up and not try again. I believe it was Alexander Whyte who said, "The victorious Christian life is a series of new beginnings." If you need to, make today a new beginning. How? By confessing and forsaking all known sin. Remember what Proverbs 28:13 says, “The one who conceals his sins will not prosper, but whoever confesses and renounces them will find mercy.”