God teaches through our mistakes. Sometimes this is the only way the Lord can get through our sinfulness and stubbornness. In high school, I constructed a very flawed desk with many errors. From a beauty point of view, it was not very pretty, but from a learning point of view, it was an important lesson. It may take significant mistakes or poor performance before we become teachable and moldable. Although this was just a desk, sometimes life is similar.
As sinful people, we desire to go our own way and don’t check in with the Lord. Sometimes this is the wrong direction, but we think there will not be consequences. Later, when we find ourselves in the muck and mire, we cry to God for help. When this happens, I find myself with a softened heart. Psalm 40:2 He lifted me out of the pit of despair, out of the mud and the mire. He set my feet on solid ground and steadied me as I walked along. 
Wanting a King Was a Significant Mistake
The Israelites were tired of Samuel’s sons he appointed as judges because they were corrupt. It was understandable that the Israelites wanted just leaders, but in doing so, they wanted a king like their neighbors. Children often use the same tactic saying their friend is allowed to do something, and why can’t I? In seeking a king, Israel was rejecting God. Although the Lord would let them have a king, He warned them through Samuel about the consequences.
The people ignored God’s warning and went down the path of having kings with all the difficulties they would bring to their nation. 1 Samuel 8:7 “Samuel, do everything they say to you,” the Lord replied, “for they are rejecting me, not you. They don’t want me to be their king any longer. 8 Ever since I brought them from Egypt, they have continually abandoned me and followed other gods. And now they are giving you the same treatment. 9 Do as they ask, but solemnly warn them about the way a king will reign over them.” 
The Prodigal Son
In the Gospel of Luke, a son asked for his father’s inheritance before he died, which was very selfish, but the father allowed it. The son took the money and spent it all on wild living. The young man then hired himself out to feed pigs and was so hungry he longed to eat what the pigs were eating.
In his hopeless condition, his heart softened. Luke 15:17 “When he finally came to his senses, he said to himself, ‘At home, even the hired servants have food enough to spare, and here I am dying of hunger! Later, he returned home, repentant of what he had done. His father had mercy and ran to him and hugged him. In life, we are much like this son and the nation of Israel, where it takes hardship from our sinful decisions to lead us to repentance. The good news is when we do, our heavenly Father is there to forgive and hug us.
To learn how God teaches through our mistakes, listen here:
[1-3] Tyndale House Publishers. (2015). Holy Bible: New Living Translation . Tyndale House Publishers.