diff --git a/Kernel/Controller.php b/Kernel/Controller.php index 1e93190..d86cd25 100644 --- a/Kernel/Controller.php +++ b/Kernel/Controller.php @@ -55,11 +55,11 @@ final class controller public function execute() { if (!class_exists($this->_A_urlParts['controller'])) { - throw new ControllerException("Controller " . $this->_A_urlParts['controller'] . " is not valid."); + throw new NotFoundException("Controller " . $this->_A_urlParts['controller'] . " is not valid."); } if (!method_exists($this->_A_urlParts['controller'], $this->_A_urlParts['action'])) { - throw new ControllerException("Action " . $this->_A_urlParts['action'] . " of controller " . + throw new NotFoundException("Action " . $this->_A_urlParts['action'] . " of controller " . $this->_A_urlParts['controller'] . " is not valid."); } diff --git a/Kernel/Exceptions/NotFoundException.php b/Kernel/Exceptions/NotFoundException.php new file mode 100644 index 0000000..d5a4600 --- /dev/null +++ b/Kernel/Exceptions/NotFoundException.php @@ -0,0 +1,3 @@ +getMessage()); + View::openBuffer(); + View::show("errors/500", $O_exception->getMessage()); + } + catch (NotFoundException $O_exception) + { + View::openBuffer(); + View::show("errors/404"); } catch (HTTPSpecialCaseException $O_exception) { - // drop old buffer - View::closeBuffer(); View::openBuffer(); - View::show("errors/".$O_exception->getHTTPCode(), $O_exception->getMsg()); - - $content = View::closeBuffer(); - View::show('html', array('body' => $content)); - return; }