WISHING FOR DEATH H 41 "None of you should wish for death because of a misfortune that comes to him. When anyone is badly afflicted, he should say: 'Allah let me live as long as my life is better for me, and cause me to die when death is better for me.'" R 41 Bukhari and Muslim with a chain up to Anas who related that the Prophet, praise and peace be upon him, said this.
40- وعن أنس رضي الله عنه ، قَالَ : قَالَ رسولُ الله صلى الله عليه وآله وسلم : "لا يَتَمَنَّيَنَّ أَحَدُكُمُ المَوتَ لضُرٍّ أَصَابَهُ، فَإِنْ كَانَ لاَ بُدَّ فاعلاً ، فَليَقُلْ : اللَّهُمَّ أحْيني مَا كَانَتِ الحَيَاةُ خَيراً لِي، وَتَوفّنِي إِذَا كَانَتِ الوَفَاةُ خَيراً لي" مُتَّفَقٌ عَلَيهِ .