function exception(ErrorException $error) { parent::exception($error); if (ob_get_level()) { ob_end_clean(); } try { \Radical\Web\Page\Handler::init(); \Radical\Web\Page\Handler::$stack->push(new PageRequest(null)); //@todo Remove ugly hack $page = new Error($error); while ($page) { $page = $page->GET(); } \Radical\Web\Page\Handler::current(true)->headers->output(); } catch (\Exception $ex) { die('Error: ' . $ex->getMessage()); } exit; }
function exception(ErrorException $error) { if ($this->in_error) { return; } parent::exception($error); $this->in_error = true; $c = Colors::getInstance(); //Code if ($error instanceof IToCode) { $code = $error->toCode(); } else { if ($error->isFatal()) { $code = $c->getColoredString('FATAL', 'red'); } else { $code = $c->getColoredString('ERROR', 'light_red'); } } //Format Output $message = $error->getMessage(); if ($message[0] != '[') { $message = ' ' . $message; } $output = sprintf(static::CLI_START, $code, $message); //If Threaded include ThreadID /*$T = Thread::current(); if($T){//If threading if($T->parent || count($T->children)){ $output = '['.$c->getColoredString('#'.$T->getId(),'cyan').']'.$output; } }*/ //Output it \Radical\CLI\Console\Colors::getInstance()->Output($output); //OB if (ob_get_level()) { ob_flush(); } $this->in_error = false; }