Authors:

Some suffering is given in order to chastise and correct a person for wrongful patterns of life (as in the case of Jonah imperiled by the storm), some suffering is given not to correct past wrongs but to prevent future ones (as in the case of Joseph sold into slavery), and some suffering has no purpose other than to lead a person to love God more ardently for himself alone and so discover the ultimate peace and freedom.

Timothy Keller (2013). “Walking with God through Pain and Suffering”, p.40, Penguin
Some suffering is given in order to chastise and correct a person for wrongful patterns of life (as in the case of Jonah imperiled by the storm), some suffering is given not to correct past wrongs but to prevent future