Throw an exception when required fields are not set