"He who digs a pit will fall into it, and he who rolls a stone, it will come back on him"
This proverb is a warning against revenge and paybacks. The evil we plan for others will often come back on us. It could be called the law of revenge.
It is a common feeling to want to get back at someone who has wounded you. This feeling often becomes anger and then a plan to make them pay. Solomon is saying that God has rigged the world in such a way that your plan for revenge will only mess up your life as much or more than it will ever mess up the other person's life.
Your fixation on the selfish pleasure of revenge will change you and bring the same destruction on you that you want on your adversary.
This means that when you have been wronged in business, marriage, church, politics, inheritance, etc., it is best not to plan elaborate ways to get back at people. Move on and build a positive life with positive contributions. If the person is criminally liable, then hand them over to the authorities but do not spend your energies on vengeance; it will just backfire on you.
Psalm 7:15, 16 and Ecclesiastes 10:8 are parallel verses speaking of the same law of revenge.
Solomon doesn't say it here but God says it later. "Vengeance is mine," thus saith the Lord. "I will repay." While there is great delight in planning to pay a person back, it will not bring about the desired result but instead will bring harm to you.
Hand over to God and his agents the vengeance you seek. If those who are objective see that this person needs to be punished for his/her action, then it will be justice and not vengeance. Move forward with a plan to bless others, love others, and help others. Your life will be much more blessed if you will move past revenge.
Now I must say something about justice for criminal offenders here. If a person has done something criminally wrong, then turning them into the police or the government is not seeking vengeance; it is loving the person and the community at large.