public function __toString()
{
try {
$content = $this->render();
} catch (\Exception $e) {
/*
__toString method can't throw exceptions. In case of exception you will end with unclear error message.
We can't avoid that here. So just logging clear error message in logs and rethrowing the same exception.
*/
ipLog()->error('View.toStringException: Exception in View::__toString() method.', array('exception' => $e, 'view' => $this->file));
if (ipConfig()->isDevelopmentEnvironment()) {
return "<pre class=\"error\">\n" . $e->getMessage() . "\n" . $e->getTraceAsString() . "\n</pre>";
} else {
return '';
}
}
return $content;
}