I heard Messenger of Allah ﷺ as saying: There is nothing (in the form of trouble) that comes to a believer even if it is the pricking of a thorn that there is decreed for him by Allah good or his sins are obliterated. (Using translation from Muslim 2572g)
عَنْ رَسُولِ اللهِ ﷺ أَنَّهُ قَالَ مَا مِنْ شَيْءٍ يُصِيبُ الْمُؤْمِنَ حَتَّى الشَّوْكَةِ تُصِيبُهُ إِلَّا كَتَبَ لَهُ بِهَا حَسَنَةً أَوَ حَطَّ عَنْهُ بِهَا خَطِيئَةً