Abu Hurairah and Abu Saeed Khudri reported,

The Prophet ﷺ said, "No fatigue, illness, anxiety, sorrow, harm, or distress befalls a Muslim, not even a thorn that pricks him, without Allah expiating some of his sins through it."

Azami 12546

Sahih

عن أبي سعيد الخدري وأبي هريرة

عن النبي ﷺ قال: ما يصيب المسلم من نصب، ولا وصب، ولا هم ولا حزن، ولا أذى، ولا غم، حتى الشوكة يشاكها، إلا كفر الله بها من خطاياه.

الأعظمي 12546صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Tafsir of the great Quran
Chapter
Virtues of Surah Baqarah
Section
His saying, "And if We give man a taste of mercy from Us and then withdraw it from him, indeed he is despairing and ungrateful. And if We give him a taste of favor after hardship has touched him, he will surely say, 'The bad times have gone from me.' Indeed he is exultant and boastful. Except for those who are patient and do righteous deeds, for them is forgiveness and a great reward."
Numbering
Jami al-Kamil 12546 (2nd edition)
Azami 12546