/** * Handles uncaught exceptions that occur in the script * @param \Exception $error */ public static function ExceptionHandler(\Exception $error) { /** * Register error * Does not register error if it is the same as last */ $last = end(self::$errors); if (!is_null($last) && ($last['file'] != $error->getFile() && $last['line'] != $error->getLine())) { self::RegisterError($error->getCode(), $error->getMessage(), $error->getFile(), $error->getLine(), $error->getTrace()); } /** * Generate error report */ $report = ['exception' => get_class($error), 'type' => $error->getCode(), 'message' => $error->getMessage(), 'file' => $error->getFile(), 'line' => $error->getLine(), 'trace' => $error->getTrace()]; /** * Write log file */ try { $log = new Storage\File('Logs/' . Misc\Debug::ErrorTypeToString($error->getCode()) . '-' . time() . '.php.ser'); $log->write(serialize($report)); $log->save(); } catch (\Exception $e) { } /** * Display error */ self::$displayData = [$error, $report]; Web::Abort(500); }
<?php /* * ____ __ * / __ \/ /______ _ * / / / / //_/ __ `/ * / /_/ / ,< / /_/ / * \____/_/|_|\__,_/ * * @author Ole K. Aanensen <*****@*****.**> * @copyright Copyright (c) 2015, okastudios.com * */ /** * Include autoloader */ require __DIR__ . '/../Bootstrap/autoload.php'; /** * Require app */ require __DIR__ . '/../Bootstrap/app.php'; /** * Initialize application */ \Oka\Web::Execute();