In Rauzat al-Vaezeen it is narrated that God's Prophet (a.s) said
“There are some excellent ranks in Heaven which one cannot attain unless he suffers from a calamity. But whenever you suffer a calamity, recall my calamities which are the worst calamities.”