I am completely astonished at your actions. Smacking a child at any age for any reason is an assault, and as far as I am concerned, should be regarded as such by the law just as much as an assault by one adult on another. I was smacked as a child, and it never did me any good. It took many more years than it would otherwise done before I was able to appreciate what my parents were doing. The only effect which a smack has on a child is that it teaches the child that you are a violent person who believes that assaulting people (rather than talking logically) is somehow acceptable.
In any case, being sick on the carpet is an unfortunate accident which happens as a result of an illness, and is not in any way "wrong" or "naughty".
What you "should do" about it is clear up the sick and comfort your child in his illness, rather than assaulting him.