What does the Church teach about suicide? From the Catechism:
2280 Everyone is responsible for his life before God who has given it to him. It is God who remains the sovereign Master of life. We are obliged to accept life gratefully and preserve it for his honor and the salvation of our souls. We are stewards, not owners, of the life God has entrusted to us. It is not ours to dispose of.
2281 Suicide contradicts the natural inclination of the human being to preserve and perpetuate his life. It is gravely contrary to the just love of self. It likewise offends love of neighbor because it unjustly breaks the ties of solidarity with family, nation, and other human societies to which we continue to have obligations. Suicide is contrary to love for the living God.
2282 If suicide is committed with the intention of setting an example, especially to the young, it also takes on the gravity of scandal. Voluntary co-operation in suicide is contrary to the moral law.
Many people conclude that the Church therefore claims that everyone who commits suicide goes straight to Hell, because their last act before dying is a morTal sin. However, the next paragraph from the Catechism says this:
Grave psychological disturbances, anguish, or grave fear of hardship, suffering, or torture can diminish the responsibility of the one committing suicide.
The act itself is always a grave matter; but for an action to be a mortal sin, the person must know that it is a grave matter, and he must do it voluntarily. The modern Church understands that depression and other psychological disturbances that might lead a person to suicide are true illnesses, which can significantly mitigate both a person's understanding and free will.
Moreover, even if a person's death seems quick, with no time to repent before the end, we have no way of knowing what happens between their soul and a merciful God, who wants to bring all of His children home to Himself:
2283 We should not despair of the eternal salvation of persons who have taken their own lives. By ways known to him alone, God can provide the opportunity for salutary repentance. The Church prays for persons who have taken their own lives.
This is not to say that we should assume that everyone who commits suicide becomes reconciled to God. All men and women are free to choose God or to reject Him; so it would be wrong to presume that all souls are saved. On the contrary, our faith in the mercy of God commands that we pray for all the living and for all the dead. We have no right to presume either that someone who has died is in Hell or (if he's not a saint!) that he's in Heaven. Prayer is always appropriate, and it always our duty.
It would also behoove us, as Catholics, to educate ourselves about depression and other mental illnesses. We do not believe in a Mental Prosperity Gospel, where God rewards His faithful ones with a sense of well-being and good cheer. A good many of the saints were as close to God as they could come -- Mother Teresa comes to mind -- and yet they struggled constantly against the darkness. Depression and mental illness are not a sign of personal sin, but one of many signs of the weakness we all inherited when Adam sinned.