Error handler

This commit is contained in:
JonatanRek 2020-04-25 09:37:55 +02:00
parent fe787163d0
commit 79016fed87
1 changed files with 21 additions and 0 deletions

21
library/ErrorHandler.php Normal file
View File

@ -0,0 +1,21 @@
<?php
class ErrorHandler {
static function exception($exception){
error_log($exception);
header($_SERVER['SERVER_PROTOCOL'] . ' 500 Internal Server Error', true, 500);
echo '<html>
<head>
<title>Error!</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
</head>
<body>
<h1>Oops!</h1>
<p>Something went wrong!</p>
</body>
</html>';
exit;
}
}
set_exception_handler('ErrorHandler::exception');