Throw an exception if the class couldn't be instantiated.