Professional failure

What is worse, to get caught doing something wrong or doing it in the first place?