Hardships and ease are a trial for you. Everything Allah chooses for you; from good or evil, is for your benefit. Whatever occurred to you could not have missed you and what missed you could never have reached you. Rewards are only for those who are patient with the Decree of Allah.
Panic and impatience cannot prevent Allahs Decree. Shakwah (complaining) is contradictory
to Sabr (patience). Allah alone can protect you from harm and ease your difficulties. If you are involved in some kind of disobedience to Allah then the affliction is a punishment for you and a reminder to leave your evil deeds. Otherwise, Allah has caused this affliction to test your patience.