getCode(); if ($code != 404) { $code = 500; } http_response_code($code); if (\App\Config::SHOW_ERRORS) { echo "

Fatal error

"; echo "

Uncaught exception: '" . get_class($exception) . "'

"; echo "

Message: '" . $exception->getMessage() . "'

"; echo "

Stack trace:

" . $exception->getTraceAsString() . "

"; echo "

Thrown in '" . $exception->getFile() . "' on line " . $exception->getLine() . "

"; } else { $log = dirname(__DIR__) . '/logs/' . date('Y-m-d') . '.txt'; ini_set('error_log', $log); $message = "Uncaught exception: '" . get_class($exception) . "'"; $message .= " with message '" . $exception->getMessage() . "'"; $message .= "\nStack trace: " . $exception->getTraceAsString(); $message .= "\nThrown in '" . $exception->getFile() . "' on line " . $exception->getLine(); error_log($message); View::renderTemplate("$code.html"); } } }