My darling 7-yr-old rescue Yorkie was vomiting yellow foamy liquid 3 years ago when I first got him. It would come and go over the weeks, months, years. After many vet visits, xrays and anguish on my part, I finally realized on my own that Paco was reacting to ME. If I was upset or sick, Paco was upset and sick. It's been nearly a year since I figured it out, and my darling hasn't been sick since.
Of course, he's ALWAYS affected if he gets hold of something he shouldn't eat. Well-meaning friends/relatives try to sneak him treats/table food. Once he ate half a bar of soap! But now that I try my very best to keep bad things away from him and keep bad thoughts away from me

he's doing well! And so am I.