public function __toString() { try { return $this->render(); } catch (Exception $e) { $error_response = Kohana_exception::handler($e); return $error_response; } }
public function doIncludeViews($text) { if (preg_match_all('/{{([^\\s{}]++)}}/', $text, $matches, PREG_SET_ORDER)) { $replace = array(); $replace = array(); foreach ($matches as $set) { list($search, $view) = $set; try { $replace[$search] = View::factory($view)->render(); } catch (Exception $e) { ob_start(); // Capture the exception handler output and insert it instead Kohana_exception::handler($e); $replace[$search] = ob_get_clean(); } } $text = strtr($text, $replace); } return $text; }