Improving error handling on bad parameters