Are you sure that the throw is actually being called? Perhaps put a cout statement in the if block. Did you try throwing a plain int instead of an enum?

Also, you don't initialize numberOfRows, so if the input fails, it will be some garbage number that is probably not 0, so the if (!numberOfRows) part will probably never be true.