'Abdullah bin 'Umar bin Al-Khattab (May Allah be pleased with them) reported that:
The Prophet (ﷺ) said, "Allah accepts a slave's repentance as long as the latter is not on his death bed (that is, before the soul of the dying person reaches the throat)".[At-Tirmidhi, who categorised it as Hadith Hasan]. (DE)
Arabic/English book reference (DE): Book 1, Hadith 18 (DE)