Allah is the most compassionate of all. When Allah’s sincere servants make any mistake, they should not be seized by pessimism, for upon making a mistake, they should not be depressed but turn to Allah and ask His forgiveness. Allah commanded the Prophet Muhammad (saas) to say the following about this issue:
Say [from Me]: “My servants, you who have transgressed against yourselves, do not despair of the mercy of Allah. Truly, Allah forgives all wrong actions. He is the Ever-Forgiving, the Most Merciful.” (Surat az-Zumar, 53)