function __construct(ErrorException $ex)
 {
     $this->heading = $ex->getHeading();
     $this->fatal = $ex->isFatal();
     $this->message = $ex->getMessage();
     if (method_exists($ex, 'getDebugMessage')) {
         $this->debugMessage = $ex->getDebugMessage();
     }
     if (method_exists($ex, 'getTraceOutput')) {
         $this->trace_output = $ex->getTraceOutput();
     } else {
         $this->trace_output = $ex->getTraceAsString();
     }
     $this->class = get_class($ex);
 }
 function exception(ErrorException $error)
 {
     if ($this->in_error) {
         return;
     }
     $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;
 }
 function __construct($message, $heading = 'Database Error')
 {
     parent::__construct($message, $heading);
 }
 /**
  * Is called when an unhandled exception is received.
  * 
  * @param ErrorException $ex the error exception defining the unhandled exception
  * @param bool $fatal usually is true (fatal)
  */
 private static function handleException(ErrorException $ex, $fatal = false)
 {
     if ($ex->isFatal() || $fatal) {
         Handler::getInstance()->Exception($ex);
     }
 }
 function __construct($message, $header = 'An error has occurred', $fatal = false)
 {
     parent::__construct($message, $header, $fatal);
     $errorHandler = Handler::getInstance();
     $errorHandler->Error($this);
 }