aboutsummaryrefslogtreecommitdiff
path: root/lib/Minz/Error.php
diff options
context:
space:
mode:
authorGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2014-09-26 14:36:30 +0200
committerGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2014-09-26 14:36:30 +0200
commit147a3d21bbe78ae66c7134ac0c355472a92e1159 (patch)
tree7f8ca64ccc0939c8c9aef145a8fd86cc2e52640b /lib/Minz/Error.php
parent7e949d50320317b5c3b5a2da2bdaf324e794b2f7 (diff)
parentc14162221365077bcaeecde7127806190490dd58 (diff)
Merge branch 'dev'
Diffstat (limited to 'lib/Minz/Error.php')
-rw-r--r--lib/Minz/Error.php32
1 files changed, 24 insertions, 8 deletions
diff --git a/lib/Minz/Error.php b/lib/Minz/Error.php
index 337ab6c0a..c8222a430 100644
--- a/lib/Minz/Error.php
+++ b/lib/Minz/Error.php
@@ -23,13 +23,32 @@ class Minz_Error {
$logs = self::processLogs ($logs);
$error_filename = APP_PATH . '/Controllers/errorController.php';
+ switch ($code) {
+ case 200 :
+ header('HTTP/1.1 200 OK');
+ break;
+ case 403 :
+ header('HTTP/1.1 403 Forbidden');
+ break;
+ case 404 :
+ header('HTTP/1.1 404 Not Found');
+ break;
+ case 500 :
+ header('HTTP/1.1 500 Internal Server Error');
+ break;
+ case 503 :
+ header('HTTP/1.1 503 Service Unavailable');
+ break;
+ default :
+ header('HTTP/1.1 500 Internal Server Error');
+ }
+
if (file_exists ($error_filename)) {
$params = array (
'code' => $code,
'logs' => $logs
);
- Minz_Response::setHeader ($code);
if ($redirect) {
Minz_Request::forward (array (
'c' => 'error'
@@ -41,19 +60,16 @@ class Minz_Error {
), false);
}
} else {
- $text = '<h1>An error occured</h1>'."\n";
+ echo '<h1>An error occured</h1>' . "\n";
if (!empty ($logs)) {
- $text .= '<ul>'."\n";
+ echo '<ul>' . "\n";
foreach ($logs as $log) {
- $text .= '<li>' . $log . '</li>'."\n";
+ echo '<li>' . $log . '</li>' . "\n";
}
- $text .= '</ul>'."\n";
+ echo '</ul>' . "\n";
}
- Minz_Response::setHeader ($code);
- Minz_Response::setBody ($text);
- Minz_Response::send ();
exit ();
}
}