On the authority of Jundub ibn Abdullah (may Allah be pleased with him), who said that the Messenger of Allah (ﷺ) said:
There was amongst those before you a man who had a wound. He was in [such] anguish that he took a knife and made with it a cut in his hand, and the blood did not cease to flow till he died. Allah the Almighty said: My servant has himself forestalled Me; I have forbidden him Paradise. It was related by al-Bukhari.
:عَنْ جُنْدُبٍ بِن عَبْدِاللهِ رَضِيَ اللهُ عَنْهُ قَالَ : رَسُولُ اللهِ صَلَّى الله عَلَيْهِ وَ سَلَّمَ

كَانَ فِيمَنْ كَانَ قَبْلَكُمْ رَجُلٌ بِهِ جُرْحٌ فَجَزِعَ فَأَخَذَ سِكِّينًا فَحَزَّ بِهَا يَدَهُ فَمَا رقَأَ الدَّمُ حَتَّى ماتَ قَالَ اللهُ تَعَالَى : بَادَرَنِي عَبْدِي بِنَفْسِهِ حَرَّمْتُ عَلَيْهِ الجَنَّةَ
رواه البخاري
Arabic/English book reference : Hadith 28