Purana Jyotisha Sangraha · by Vyasa
Chapter 8 · Dreams and Eclipse Rules
ब्रह्मवैवर्तपुराणम् : शुभाशुभस्वप्नाः ग्रहणनियमाश्च
एता दृष्ट्वा च स्पृष्ट्वा च ब्रह्महत्यां लभेन्नरः ।तस्माद्दैवेन ता दृष्ट्वा सूर्य्यं दृष्ट्वा हरिं स्मरेत् ॥ ५४ ॥
From the Brahmavaivarta Purana, print Krishna-janma Khanda ch 78, verse 54.
A man who sees or touches these gets the sin of killing a Brahmin. So, if he sees them by chance, he should look at the Sun and remember Hari.
Simple meaning: Seeing or touching these is said to bring sin, and remembering Hari is said to ease it.
कामतो यदि पश्यन्ति विनिन्द्यास्ते भवन्ति वै ।
Looking on purpose is said to bring blame, so good people avoid it.
राहुग्रस्तं रविं सोमं न पश्यन्ति विपश्चितः ।
The wise avoid looking at an eclipse, especially when the Sun is in certain houses from the birth sign.
जन्मर्क्षे निधनं चापि चतुर्थेऽपि कलानिधौ ।
The text lists times when the Moon should not be looked at, such as the 4th moon day of Bhadra.