Finding Mercy in Catastrophes with Prophet Moses

How could catastrophes turn into mercy? Is there anything in the Quran that proves this concept? Check Prophet Moses encounter with Al-Khidr.