The purpose of suffering is to improve our thought process, that is that we should have pleasant and nice thoughts. The reason for this is that we do not feel or think about how we suffer when we think of something pleasant or read a good book or occupy ourselves with something pleasant.
Suffering from physical injury or sickness are supposed to help us improve our thought process. The same is valid for mental illness.