The earliest Indian myth on solar eclipse is found in the "Rig Veda". (The religious book composed between 1500-1200 BC)
According to Indian mythology, solar eclipse occurs because two demons Rahu & Ketu swallow Sun. And people pray to the supreme god for early release of sun god and do not eat anything as sun god is in danger. People dispose the food and water once the eclipse is over because they become uneatable after the event.
Rahu, one of the most notorious demons of the Hindu myth, was rubbed the wrong way by the sun. Myth has it that Vishnu, God of all Gods churned the oceans to usher in peace. This was at the end of a bitter war between the Gods and demons. At this time, Dhanvantri, the fountain head of medicine,emererged with necter. This was too good for the demons to let go.Vishnu manage to get it across the Gods, but Rahu, disguised as a God tried to get some nectar for himself.The sun and the moon saw this happenning and informed Vishnu, who immediately chopped off Rahus head. Rahu lived on though bodyless, because he had managed a sip of the nectar. But he never forgave the sun or the moon and periodically eats either one up.(Source: Colors of India)