route: catch the exception generated by route itself, and display the error page
git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@3732 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
@@ -296,7 +296,7 @@ class route
|
||||
}
|
||||
|
||||
if (!isset ($_SERVER["REQUEST_METHOD"]))
|
||||
throw new Exception ("No REQUEST_METHOD", 415);
|
||||
$this->error (new \Exception ("No REQUEST_METHOD", 415));
|
||||
if ($_SERVER["REQUEST_METHOD"] === "GET" ||
|
||||
$_SERVER["REQUEST_METHOD"] === "POST" ||
|
||||
$_SERVER["REQUEST_METHOD"] === "PUT" ||
|
||||
@@ -306,7 +306,7 @@ class route
|
||||
return $_SERVER["REQUEST_METHOD"];
|
||||
}
|
||||
|
||||
throw new Exception ("Invalid REQUEST_METHOD", 406);
|
||||
$this->error (new \Exception ("Invalid REQUEST_METHOD", 406));
|
||||
}
|
||||
|
||||
/** Return the mached route search
|
||||
@@ -492,8 +492,8 @@ class route
|
||||
if ($rcRegex === false)
|
||||
{
|
||||
if (count (error_get_last()))
|
||||
throw new \Exception ("Invalid regex provided: $regex : ".
|
||||
error_get_last()["message"], 500);
|
||||
$this->error (new \Exception ("Invalid regex provided: $regex : ".
|
||||
error_get_last()["message"], 500));
|
||||
}
|
||||
if ($rcRegex !== FALSE && $rcRegex !== 0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user