Entity Metadata Wrapper - check filtered text value is set I'm seemingly unable to check for the existence of a value of a field if the field in question is set to filtered text. The following code returns an error - and any possible combination I've tried to find online results in the same:

if ($wrapper-&gt;__isset('body')) {
  print $wrapper-&gt;body-&gt;value-&gt;value();
}


The error:

EntityMetadataWrapperException: Unable to get the data property value as the parent data structure is not set. in EntityStructureWrapper-&gt;getPropertyValue() (line 438 of /Applications/MAMP/htdocs/arch-main/httpdocs/sites/all/modules/contrib/entity/includes/entity.wrapper.inc).


To be clear, the node does have the body field, but no content has been placed in it.

Any ideas on how to check for this?

EDIT:

Ok this seems to work, but there must be a better way

try {
          print $wrap-&gt;body-&gt;value-&gt;value();
        } catch (EntityMetadataWrapperException $e) {
          // ???
        }
but there must be a better way


If you find it, do share :)

Seriously though, this is what the language gives you; exception handling is what you should use to handle exceptional circumstances, and an entity not having a field that you're expecting it to have would probably class as exceptional in most people's book. It does in mine anyway.