In Genesis 9, God makes a promise with man; that allows them to accept their mistakes and to have a second chance. God begins by blessing Noah and his sons with a covenant saying that there will no longer be any floods that destroy humanity. God tells them that he will mark the clouds with a bow (Rainbow) to show us that he is keeping his promise with humanity.
"God said to Noah and his sons [...] I will establish my covenant with you, that never again shall all creatures be destroyed by the waters of a flood; there shall not be another flood to devastate the earth" (Gn 9:8 & 11 ).
"Noah, a man of the soil, was the first to plant a vineyard. He drank some wine, became drunk, and lay naked inside his tent" (Gn 9:20-21).
"Shem and Japheth, however, took a robe, and holding it on their shoulders, they walked backward and covered their father's nakedness [...] When Noah woke up from his wine and learned what his youngest son had done to him" (Gn 9:23a-25).
Give people a second chance to overcome their mistakes.