That's a good question.
I also think it's best to try to prevent stomach issues, though we can't prevent them all, obviously. Sometimes a dog's tummy will be upset because he ate something, "bad," but other times, his tummy will be upset because he has a virus or another type of illness. We usually cannot prevent our dogs from becoming ill.
However, we can dog-proof our homes and keep an eye on our dogs when we are home. Dogs are like toddlers - they tend to get into everything. We have to keep our homes safe for them and train them to not eat inappropriate things.