Any characteristics of the error you want to validate?  I would suggest that a null ref here is a bad idea.  Consider looking for particular string in the error message.