/** * Handle an exception depending on the context with an HTML message or XML comment * * @param array $typoScriptPath path causing the exception * @param \Exception $exception exception to handle * @param integer $referenceCode * @return string */ protected function handle($typoScriptPath, \Exception $exception, $referenceCode) { $context = $this->environment->getContext(); if ($context->isDevelopment()) { $handler = new HtmlMessageHandler(); } else { $handler = new XmlCommentHandler(); } $handler->setRuntime($this->getRuntime()); return $handler->handleRenderingException($typoScriptPath, $exception); }