route : Add an error management in all the cases of routing. It is possible to use an external error page too.

git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@1827 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
2014-09-17 12:55:53 +00:00
parent 3690760108
commit e6b0a396e4

View File

@@ -562,10 +562,7 @@ class route
}
catch (Exception $e)
{
@header ($_SERVER["SERVER_PROTOCOL"]." 500 Internal Server Error");
// TODO : Allow a specific page to be configured and displayed
echo "<H1>Internal server error</h1>";
echo $e->getMessage();
$this->error ($e);
}
exit;
}
@@ -598,6 +595,19 @@ class route
call_user_func_array ($function, $params);
}
catch (Exception $e)
{
$this->error ($e);
}
exit;
}
if ($this->debug)
echo "==> NO MATCH\n";
}
/** Print an error page. If a custom page exists, use it
@param $e Exception to print */
public function error ($e)
{
if ($e->getCode () === "")
$getCode = 500;
@@ -635,11 +645,6 @@ class route
echo $e->getMessage();
echo" </body>\n";
echo "</html>\n";
}
exit;
}
if ($this->debug)
echo "==> NO MATCH\n";
}
}