protected function handle($typoScriptPath, \Exception $exception, $referenceCode)
{
$handler = new ContextDependentHandler();
$handler->setRuntime($this->runtime);
$output = $handler->handleRenderingException($typoScriptPath, $exception);
$currentContext = $this->getRuntime()->getCurrentContext();
if (isset($currentContext['node'])) {
/** @var NodeInterface $node */
$node = $currentContext['node'];
$applicationContext = $this->environment->getContext();
if ($applicationContext->isProduction() && $this->privilegeManager->isPrivilegeTargetGranted('Neos.Neos:Backend.GeneralAccess') && $node->getContext()->getWorkspaceName() !== 'live') {
$output = '<div class="neos-rendering-exception"><div class="neos-rendering-exception-title">Failed to render element' . $output . '</div></div>';
}
return $this->contentElementWrappingService->wrapContentObject($node, $output, $typoScriptPath);
}
return $output;
}