Hermann Hesse said this quote

I began to understand that suffering and disappointments and melancholy are there not to vex us or cheapen us or deprive us of our dignity but to mature and transfigure us.