throwing specific exceptions when parameters are invalid