How much did he eat? If it was a little bit, it'll be okay. My dog eats a few M&M's every now and then. Keep an eye on him. But if it was a lot maybe call a animal hospital and see what they say. It may need its tummy pumped. My dog had hers pumped but for other reasons
It's a good sign that he is vomiting ... that will dispel any that it might have in it's stomach. I would still talk to a vet about it.
Symptoms of Chocolate Dog Ingestion and Poisoning You can recognize that your dog has eaten a toxic dose of chocolate from the symptoms. Within the first few hours, the evidence includes vomiting, diarrhea or hyperactivity. As time passes and there's increased absorption of the toxic substance, you'll see an increase in the dog's heart rate, which can cause arrhythmia, restlessness, hyperactivity, muscle twitching, increased urination or excessive panting.
This can lead to hyperthermia, muscle tremors, seizures, coma and even death.