It is reported that Shurayh — Allah have mercy on him — said:
“If I am afflicted with a calamity, I praise Allah for it four times:

I praise Him because it wasn’t worse than it was,
I praise Him when He gives me the patience to bear it,
I praise Him for enabling me to say al-istirja’ (‘To Allah we belong and to him we will return’; see Al-Baqarah: 154-156 ) in hope of a great reward,
and I praise Him for not making it a calamity in my religion.”

Al-Dhahabi, Siyar A’lam Al-Nubala`, in his biography of Shurayh Al-Qadi.