I have had this happen to me and it was one of the most painful experiences of my life. What you have to do is flush the eye with cool water first ,then try and keep the eye closed if you can make yourself an eye patch otherwise every time the pupil dilates it will cause you pain and cause you to start blinking and potentially do more damage. You can visit a doctor who can prescribe a medicine to make sure it heals properly. Your eye will need plenty of rest and you do not want to watch television or be in and out of lighting because when one eye dilates the other eye may as well so try and just rest and get some sleep the good news is the eye is one of the fastest healing parts of your body. You have to see a doctor or go to an emergency room for this though because it needs to heal properly.