throw exception to prevent a php exception