It wasnarrated from Anas that the Prophet (ﷺ) entered upon a youngmanwho was dying and said:
"How do you feel?" He said: "I havehopein Allah, O Messenger of Allah, but I fear my sins." TheMessenger ofAllah (ﷺ) said: "These two things (hope and fear) donot coexist inthe heart of a person in a situation like this, butAllah will givehim that which he hopes for and keep him safe fromthat which hefears."
English reference: Vol. 5, Book 37, Hadith 4261
Arabic reference: Book 37, Hadith 4402