/** * If an exception is thrown that is not in a try catch statement it comes * here. It is then output to the screen and code execution stops * * @param Exception $exception */ public static function exceptionHandler($exception) { //if it's not a FrameEx make it one if (!$exception instanceof FrameEx) { $exception = new FrameEx($exception->getMessage(), $exception->getCode(), FrameEx::HIGH, $exception); } try { $exception->process(); } catch (Exception $e) { trigger_error("Error logging exception: " . $e->getMessage()); } //finally echo it out trigger_error($exception->__toString()); }
/** * Add all the exceptions that have been persisted to the current page */ protected function addPersistedExceptions() { foreach (FrameEx::getPersistedExceptions() as $ex) { $this->processException($ex); } }
<?php //Object Factory require_once dirname(__FILE__) . "/model/core/Factory.php"; require_once dirname(__FILE__) . "/model/core/Autoloader.php"; $autloader = new model\core\Autoloader(); $autloader->register(); Factory::init(); Controller::boot(); Registry::init(); Cache::init(); Registry::loadDBSettings(); FrameEx::init(); Factory::attachAutoloader($autloader); //boot the app Factory::boot(APP_DIR);
/** * Original PDOException is transformed into a FrameEx * @param PDOException $ex */ public function __construct(PDOException $ex, $severity) { parent::__construct($ex->getMessage(), $ex->getCode(), $severity, $ex); }