Better support of exceptions catch by routing. The HTML page is valid, with UTF-8 support and Noindexes for robots
git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@1671 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
22
route.php
22
route.php
@@ -3,7 +3,8 @@
|
||||
@package domframework
|
||||
@author Dominique Fournier <dominique@fournier38.fr> */
|
||||
|
||||
error_reporting (E_ALL);
|
||||
require_once ("domframework/http.php");
|
||||
|
||||
/** The routing module, base of the DomFramework */
|
||||
class route
|
||||
{
|
||||
@@ -590,10 +591,25 @@ class route
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
@header ($_SERVER["SERVER_PROTOCOL"]." 500 Internal Server Error");
|
||||
if ($e->getCode () === "")
|
||||
$getCode = 500;
|
||||
else
|
||||
$getCode = $e->getCode ();
|
||||
|
||||
$http = new http ();
|
||||
@header ($_SERVER["SERVER_PROTOCOL"]." $getCode ".$http->codetext ($getCode));
|
||||
// TODO : Allow a specific page to be configured and displayed
|
||||
echo "<H1>Internal server error</h1>";
|
||||
echo "<html>\n";
|
||||
echo " <head>\n";
|
||||
echo " <title>".$http->codetext ($getCode)."</title>\n";
|
||||
echo " <meta charset='utf-8'>\n";
|
||||
echo " <meta name='ROBOTS' content='NOINDEX, NOFOLLOW'>\n";
|
||||
echo " </head>\n";
|
||||
echo" <body>\n";
|
||||
echo "<h1>".$http->codetext ($getCode)."</h1>";
|
||||
echo $e->getMessage();
|
||||
echo" </body>\n";
|
||||
echo "</html>\n";
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user