Hazrat Shaikh Moulana Muhammad Zakariyya (rahmatullahi ‘alaih) writes:

There are numerous places in the Qur’an and hadith where we are exhorted and encouraged to remain patient in the face of adversity. One should not consider the difficulties and hardships one undergoes as a sheer misfortune and calamity. Instead, at times, Allah Ta’ala out of His infinite grace and wisdom puts one through certain trials during his life in order to bless him with His divine grace. (Fazaail-e-Sadaqaat [urdu], Part 2 –pg.369)