Throw an error if an illegal variable type is passed to var().