Catch the non catched exception in routes and display them in Internal server error

git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@1374 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
2014-06-01 07:53:46 +00:00
parent 3ec8e3f052
commit 9398370664

View File

@@ -530,7 +530,17 @@ class route
{ {
if ($this->debug) if ($this->debug)
echo "==> FOUND EQUAL !\n"; echo "==> FOUND EQUAL !\n";
$function (); try
{
$function ();
}
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();
}
exit; exit;
} }
@@ -556,7 +566,18 @@ class route
else else
$params[] = null; $params[] = null;
} }
call_user_func_array ($function, $params);
try
{
call_user_func_array ($function, $params);
}
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();
}
exit; exit;
} }