Messenger of Allah ﷺ said: There is no trouble that comes to a believer except that it obliterates from his sins, even if it is the pricking of a thorn (Using translation from Muslim 2572e)
قَالَ رَسُولُ اللهِ ﷺ مَا مِنْ مُصِيبَةٍ يُصَابُ بِهَا مُسْلِمٌ إِلَّا كُفِّرَ عَنْهُ حَتَّى الشَّوْكَةِ يُشَاكُهَا