God never says good to our sins, but He does not assume that our failures are the end of everything. By His grace, He will bring for the good of our greatest defeats.
And we know that in all things God works for the good of those who love him, who have been called according to his purpose (Romans 8:28)