/**
* Handle an Exception thrown while rendering TypoScript according to
* settings specified in Neos.Fusion.rendering.exceptionHandler
*
* @param array $typoScriptPath
* @param \Exception $exception
* @param boolean $useInnerExceptionHandler
* @return string
* @throws InvalidConfigurationException
*/
public function handleRenderingException($typoScriptPath, \Exception $exception, $useInnerExceptionHandler = false)
{
$typoScriptConfiguration = $this->getConfigurationForPath($typoScriptPath);
if (isset($typoScriptConfiguration['__meta']['exceptionHandler'])) {
$exceptionHandlerClass = $typoScriptConfiguration['__meta']['exceptionHandler'];
$invalidExceptionHandlerMessage = 'The class "%s" is not valid for property "@exceptionHandler".';
} else {
if ($useInnerExceptionHandler === true) {
$exceptionHandlerClass = $this->settings['rendering']['innerExceptionHandler'];
} else {
$exceptionHandlerClass = $this->settings['rendering']['exceptionHandler'];
}
$invalidExceptionHandlerMessage = 'The class "%s" is not valid for setting "Neos.Fusion.rendering.exceptionHandler".';
}
$exceptionHandler = null;
if ($this->objectManager->isRegistered($exceptionHandlerClass)) {
$exceptionHandler = $this->objectManager->get($exceptionHandlerClass);
}
if ($exceptionHandler === null || !$exceptionHandler instanceof AbstractRenderingExceptionHandler) {
$message = sprintf($invalidExceptionHandlerMessage . "\n" . 'Please specify a fully qualified classname to a subclass of %2$s\\AbstractRenderingExceptionHandler.' . "\n" . 'You might implement an own handler or use one of the following:' . "\n" . '%2$s\\AbsorbingHandler' . "\n" . '%2$s\\HtmlMessageHandler' . "\n" . '%2$s\\PlainTextHandler' . "\n" . '%2$s\\ThrowingHandler' . "\n" . '%2$s\\XmlCommentHandler', $exceptionHandlerClass, 'Neos\\Fusion\\Core\\ExceptionHandlers');
throw new InvalidConfigurationException($message, 1368788926);
}
$exceptionHandler->setRuntime($this);
if (array_key_exists('__objectType', $typoScriptConfiguration)) {
$typoScriptPath .= sprintf('<%s>', $typoScriptConfiguration['__objectType']);
}
$output = $exceptionHandler->handleRenderingException($typoScriptPath, $exception);
return $output;
}