error handling

This commit is contained in:
MaZderMind 2015-03-27 14:21:34 +01:00
parent f98d93cd15
commit 1a050c087e
5 changed files with 42 additions and 4 deletions

View file

@ -89,7 +89,8 @@ body.relive-player {
@import "_relive_player.less";
}
body.e404 {
body.e404,
body.e500 {
> .container {
text-align: center;
h1 {
@ -104,6 +105,16 @@ body.e404 {
}
}
body.e500 {
pre {
text-align: left;
}
img {
.rotate(180deg);
}
}
body.feedback {
.feedback-thankyou {
font-size: @jumbo-font-size;

View file

@ -32,8 +32,8 @@ $tpl->set(array(
));
ob_start();
try {
if($route == '')
{
include('view/overview.php');
@ -135,10 +135,11 @@ try {
}
catch(NotFoundException $e)
{
ob_clean();
include('view/404.php');
}
catch(Exception $e)
{
header("HTTP/1.1 500 Internal Server Error");
die($e);
ob_clean();
include('view/500.php');
}

View file

@ -1,4 +1,12 @@
<?php
function exception_error_handler($errno, $errstr, $errfile, $errline ) {
if (ini_get('error_reporting') == 0)
return;
throw new ErrorException($errstr, 0, $errno, $errfile, $errline);
}
set_error_handler("exception_error_handler");
class NotFoundException extends Exception {}
class ScheduleException extends Exception {}

8
template/500.phtml Normal file
View file

@ -0,0 +1,8 @@
<div class="container">
<h1>500 Internal Winkekatze Error</h1>
<div class="well">
<pre><?=h($e)?></pre>
</div>
<img src="assets/img/missing-cat.png" alt="500 Internal Winkekatze Error" />
</div>

10
view/500.php Normal file
View file

@ -0,0 +1,10 @@
<?php
header("HTTP/1.1 500 Internal Server Error");
echo $tpl->render(array(
'page' => '500',
'title' => '500 Internal Server Error',
'e' => $e,
'msg' => $e->getMessage(),
));