From 1a050c087e8f2889b421992350c50fae75a9252b Mon Sep 17 00:00:00 2001 From: MaZderMind Date: Fri, 27 Mar 2015 14:21:34 +0100 Subject: error handling --- assets/css/_structure.less | 13 ++++++++++++- index.php | 7 ++++--- lib/Exceptions.php | 8 ++++++++ template/500.phtml | 8 ++++++++ view/500.php | 10 ++++++++++ 5 files changed, 42 insertions(+), 4 deletions(-) create mode 100644 template/500.phtml create mode 100644 view/500.php diff --git a/assets/css/_structure.less b/assets/css/_structure.less index 836de2b..5de12e0 100644 --- a/assets/css/_structure.less +++ b/assets/css/_structure.less @@ -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; diff --git a/index.php b/index.php index a00efc3..b4c87ad 100644 --- a/index.php +++ b/index.php @@ -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'); } diff --git a/lib/Exceptions.php b/lib/Exceptions.php index f6f9d24..acdb1b6 100644 --- a/lib/Exceptions.php +++ b/lib/Exceptions.php @@ -1,4 +1,12 @@ +

500 Internal Winkekatze Error

+
+
+
+ + 500 Internal Winkekatze Error + diff --git a/view/500.php b/view/500.php new file mode 100644 index 0000000..6519160 --- /dev/null +++ b/view/500.php @@ -0,0 +1,10 @@ +render(array( + 'page' => '500', + 'title' => '500 Internal Server Error', + + 'e' => $e, + 'msg' => $e->getMessage(), +)); -- cgit v1.2.3