From ee285f0e4146b7e1a023aa72f44e98a329652f74 Mon Sep 17 00:00:00 2001 From: Dominique Fournier Date: Mon, 29 May 2017 12:30:34 +0000 Subject: [PATCH] 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 --- route.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/route.php b/route.php index e52835b..a7bb3ff 100644 --- a/route.php +++ b/route.php @@ -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) {