fixing Exception validation so that it throws the correct TypeError