Poche, a person can suffer from depression or anxiety. The problem comes in when they doubt God, and his infinite love for them. Sucide is doubting Gods love for you!
Also, some mental illness, not all, are a problem of chemical imbalance, poor diet, and no true faith that God forgives you (after you’ve gone to confession of course) for the sins you committed. The world is so
without Gods love, and comfort they turn their back on him by committing such a horrible selfish act. Everyone in this world needs a dose of sanctifying grace!