Raise an exception when adding a null or undefined element.