Caution: Translations of Quran and Ḥadīth may lead to possible misapplications and misinterpretations. This site is intended for students of sacred knowledge that are proficient in comprehending classical Arabic and have a strong foundation in Islamic sciences. Also note that religious injunctions rely on several aspects beyond what one may glean through reading individual aḥādīth.
bayhaqi:3386al-Ḥasan b. Aḥmad b. Ibrāhīm b. Shādhān> Ḥamzah b. Muḥammad b. al-ʿAbbās > ʿAbbās b. Muḥammad al-Dūrī > ʿUbaydullāh b. Mūsá > Isrāʾīl > Abū Isḥāq > al-Ḥārith > ʿAlī > Ayyumā

[Machine] He said: "Whichever man enters into prayer and he is struck with a rumbling in his stomach, or vomiting, or bleeding, and he fears to cause a disturbance before the Imam finishes his prayer, then he should place his hand on his nose. If he intends to count what has passed, then he should not speak until he performs ablution, then he completes what remains. If he speaks, then he should face towards him. And if he has already recited the Tashahhud and fears to cause a disturbance before the Imam finishes his prayer, then he should make the Salam, for his prayer has been completed." Ath-Thawri narrated it from Abu Ishaq from Al-Harith from Ali, in some of its meanings. Al-Harith Al-Awar is weak, and Asim bin Damrah is not strong. It was also narrated from a third chain from Ali, and it contains weakness. And Allah knows best.  

البيهقي:٣٣٨٦أَخْبَرَنَا الْحَسَنُ بْنُ أَحْمَدَ بْنِ إِبْرَاهِيمَ بْنِ شَاذَانَ بِبَغْدَادَ أنبأ حَمْزَةُ بْنُ مُحَمَّدِ بْنِ الْعَبَّاسِ ثنا عَبَّاسُ بْنُ مُحَمَّدٍ الدُّورِيُّ ثنا عُبَيْدُ اللهِ بْنُ مُوسَى أنبأ إِسْرَائِيلُ عَنْ أَبِي إِسْحَاقَ عَنِ الْحَارِثِ عَنْ عَلِيٍّ ؓ

أَنَّهُ قَالَ أَيُّمَا رَجُلٍ دَخَلَ فِي الصَّلَاةِ فَأَصَابَهُ رِزٌّ فِي بَطْنِهِ أَوْ قَيْءٌ أَوْ رُعَافٌ فَخَشِيَ أَنْ يُحْدِثَ قَبْلَ أَنْ يُسَلِّمَ الْإِمَامُ فَلْيَجْعَلْ يَدَهُ عَلَى أَنْفِهِ فَإِنْ كَانَ يُرِيدُ أَنْ يَعْتَدَّ بِمَا قَدْ مَضَى فَلَا يَتَكَلَّمْ حَتَّى يَتَوَضَّأَ ثُمَّ يُتِمَّ مَا بَقِيَ فَإِنْ تَكَلَّمَ فَلْيَسْتَقْبِلْ وَإِنْ كَانَ قَدْ تَشَهَّدَ وَخَافَ أَنْ يُحْدِثَ قَبْلَ أَنْ يُسَلِّمَ الْإِمَامُ فَلْيُسَلِّمْ فَقَدْ تَمَّتْ صَلَاتُهُ وَرَوَاهُ الثَّوْرِيُّ عَنْ أَبِي إِسْحَاقَ عَنِ الْحَارِثِ عَنْ عَلِيٍّ بِبَعْضِ مَعْنَاهُ وَالْحَارِثُ الْأَعْوَرُ ضَعِيفٌ وَعَاصِمُ بْنُ ضَمْرَةَ غَيْرُ قَوِيٍّ وَرُوِيَ مِنْ وَجْهٍ ثَالِثٍ عَنْ عَلِيٍّ ؓ وَفِيهِ أَيْضًا ضَعْفٌ وَاللهُ أَعْلَمُ  


See similar narrations below:

Collected by Suyūṭī
suyuti:4-1591bʿAli > Ayyamā
Request/Fix translation

  

السيوطي:٤-١٥٩١b

" عَنْ عَلِىٍّ قَالَ: أَيَّمَا رَجُلٍ دَخَلَ فِى الصَّلَاة فَأَصَابَهُ رِزٌّ فِى بَطنِهِ أَوْ قَيْيءٌ أَوْ رُعَافٌ فَخَشِىَ أَنْ يُحْدِثَ قَبْلَ أَنْ يُسَلِّمَ الإِمَامُ، فَليَجْعَلْ يَدَهُ عَلَى أَنفْه وَإنْ كَانَ يُرِيدُ أَنْ يَعْتَدَّ بِمَا قَدْ مَضَى فَلَا يَتَكَلَّم حَتَّى يَتَوَضَّأَ، ثُمَّ يُتِمَّ مَا بَقِىَ، فَإِنْ تَكَلَّمَ فَلْيَسْتَقْبِلْ، وَإِنْ كَانَ قَدْ تَشَهَّدَ وَخَافَ أَنْ يُحْدِثَ قَبْلَ أَنْ يُسَلِّمَ الإِمَامُ فَليُسَلِّمْ فَقَدْ تَمَتْ صَلَاتُهُ".  

[عب] عبد الرازق [ق] البيهقى في السنن