Checking parameters type and throwing exceptions