Then the princes of Israel and the king humbled themselves and said, “The Lord is righteous.”
2 Chronicles 12:6 (ESV)
It is not always easy to accept and face the consequences of our sins. Often, instead of recognizing, admitting, and confessing them, we choose to blame God for abandoning us. What we sometimes see as difficulties are to God the consequences of our sins. The Bible teaches us that God is faithful enough to forgive us our sins. But there is one condition, we must admit them and confess them openly to God.
This passage (Verses 1 to 6) reveals to us the fault of Rehoboam who, after having established his royal authority, deliberately chose to disobey the law of God. The worst part is that he led all of Israel to follow him in his disobedience. For this, God decided to punish him by inciting the king of Egypt to attack him. His defeat was the consequence of his unfaithfulness to the Lord. God not only punished him, but also made sure to inform him of His decision.
I don't know if you are suffering the consequences of a sin committed against God. But what I am sure of is that the Holy Spirit will not fail to convict you of your sin, exhort you to confess it to God, and comfort you, reminding you that God will not fail to forgive you. So if there is any sin in your life, I encourage you to do like the leaders of Israel, to humble yourself before God, acknowledge that He is righteous in His judgment, and then confess.