Narrated Anas bin Malik: The Prophet (Sallal lahu alaihi wasallam) said, “None of you should wish for death because of a calamity befalling him; but if he has to wish for death, he should say:
اللَّهُمَّ أَحْيِنِي مَا كَانَتِ الْحَيَاةُ خَيْرًا لِي، وَتَوَفَّنِي إِذَا كَانَتِ الْوَفَاةُ خَيْرًا لِي