public function handleError(\Dwoo\Exception $e) { $html = new \DOMDocument(); $html->loadHTMLFile('lib/resources/exception.html'); $message = $html->getElementById('message'); $template = $html->createDocumentFragment(); $template->appendXML($e->getMessage()); $message->appendChild($template); unset($template); $php_version = $html->getElementById('php-version'); $template = $html->createDocumentFragment(); $template->appendXML(phpversion()); $php_version->appendChild($template); unset($template); $dwoo_version = $html->getElementById('dwoo-version'); $template = $html->createDocumentFragment(); $template->appendXML(Core::VERSION); $dwoo_version->appendChild($template); unset($template); $exectime = $html->getElementById('exectime'); $template = $html->createDocumentFragment(); $template->appendXML(round(microtime(true) - $_SERVER['REQUEST_TIME'], 3)); $exectime->appendChild($template); unset($template); echo $html->saveHTML(); }
/** * @param Compiler $compiler * @param int $message */ public function __construct(Compiler $compiler, $message) { $this->compiler = $compiler; $this->template = $compiler->getDwoo()->getTemplate(); parent::__construct('Compilation error at line ' . $compiler->getLine() . ' in "' . $this->template->getResourceName() . ':' . $this->template->getResourceIdentifier() . '" : ' . $message); }