hanyuu/public/index.php

30 lines
642 B
PHP
Raw Normal View History

2023-01-06 22:20:13 +00:00
<?php
namespace Hanyuu;
require_once __DIR__ . '/../hanyuu.php';
set_exception_handler(function(\Throwable $ex) {
2023-12-15 02:38:40 +00:00
\Sentry\captureException($ex);
http_response_code(500);
ob_clean();
if(HAU_DEBUG) {
header('Content-Type: text/plain; charset=utf-8');
echo (string)$ex;
exit;
}
header('Content-Type: text/html; charset=utf-8');
2024-06-11 23:04:55 +00:00
echo file_get_contents(HAU_DIR_PUBLIC . '/error-500.html');
exit;
});
if(file_exists(HAU_ROOT . '/.migrating')) {
http_response_code(503);
2024-06-11 23:04:55 +00:00
echo file_get_contents(HAU_DIR_PUBLIC . '/error-503.html');
exit;
}
$hau->createRouting()->dispatch();