the error of (one's) ways
What has been wrong, hurtful, or unfair about one's behavior or way of life. He'll never see the error of his ways if he keeps being rewarded for the bad decisions he's made. I'm afraid it took me too long to realize the error of my ways. But it's not too late for you.
the ˌerror of your ˈways
(formal or humorous) what is wrong and should be changed about the kind of life you are leading: While he was in prison, a social worker visited him in an attempt to make him see the error of his ways.