Arthur Schopenhauer said this quote

However, the struggle with that sentinel is, as a rule, not so hard as it may seem from a long way off, mainly in consequence of the antagonism between the ills of the body and the ills of the mind. If we are in great bodily pain, or the pain lasts a long time, we become indifferent to other troubles; all we think about is to get well. In the same way great mental suffering makes us insensible to bodily pain; we despise it; nay, if it should outweigh the other, it distracts our thoughts, and we welcome it as a pause in mental suffering. It is this feeling that makes suicide easy; for the bodily pain that accompanies it loses all significance in the eyes of one who is tortured by an excess of mental suffering. This is especially evident in the case of those who are driven to suicide by some purely morbid and exaggerated ill-humor. No special effort to overcome their feelings is necessary, nor do such people require to be worked up in order to take the step; but as soon as the keeper into whose charge they are given leaves them for a couple of minutes, they quickly bring their life to an end.When, in some dreadful and ghastly dream, we reach the moment of greatest horror, it awakes us; thereby banishing all the hideous shapes that were born of the night. And life is a dream: when the moment of greatest horror compels us to break it off, the same thing happens.