LogicException example from Drupal;
if (!isset($context['target_instance'])) {
throw new \LogicException('$context[\'target_instance\'] must be set to denormalize with the FieldItemNormalizer');
}
if ($context['target_instance']->getParent() == NULL) {
throw new \LogicException('The field item passed in via $context[\'target_instance\'] must have a parent set.');
}