"We were with the Messenger of Allah ﷺ when the sun became eclipsed. The Messenger of Allah ﷺ went out dragging his garment, until he came to the masjid, and the people gathered around him. He led us in praying two rak'ahs and when (the eclipse) ended he said: 'The sun and the moon are two of the signs of Allah (SWT) by means of which Allah (SWT), the Mighty and Sublime, strikes fear into His slaves. They do not become eclipsed for the death or birth of anyone. If you see that, then pray until Allah (SWT)r relieves you of fear.' That was because his son named Ibrahim had died, and the people suggested to him that (the eclipse) happened because of that." (Using translation from Nasāʾī 1491)
كُنَّا عِنْدَ رَسُولِ اللهِ ﷺ فَانْكَسَفَتِ الشَّمْسُ فَخَرَجَ رَسُولُ اللهِ ﷺ يَجُرُّ رِدَاءَهُ حَتَّى انْتَهَى إِلَى الْمَسْجِدِ وَثَابَ إِلَيْهِ النَّاسُ فَصَلَّى بِنَا رَكْعَتَيْنِ فَلَمَّا انْكَشَفَتْ قَالَ «إِنَّ الشَّمْسَ وَالْقَمَرَ آيَتَانِ مِنْ آيَاتِ اللهِ يُخَوِّفُ اللهُ بِهِمَا عِبَادَهُ وَإِنَّهُمَا لَا يَنْخَسِفَانِ لِمَوْتِ أَحَدٍ وَلَا لِحَيَاتِهِ فَإِذَا رَأَيْتُمْ ذَلِكَ فَصَلُّوا حَتَّى يُكْشَفَ مَا بِكُمْ» وَذَاكَ أَنَّ ابْنًا لَهُ مَاتَ يُقَالُ لَهُ إِبْرَاهِيمُ فَقَالَ نَاسٌ فِي ذَلِكَ