At times Hashem brings things upon a person so that through them he will come to understand His compassion and His Godliness, may He be blessed.
Sefer HaMidos, Knowledge of God, Part I §1