Throw exception for page not found

This commit is contained in:
Frederic Guillot
2015-10-17 10:59:07 -04:00
parent 8c532efd5f
commit 3543f45c2d
4 changed files with 19 additions and 6 deletions

View File

@@ -2,6 +2,8 @@
namespace Kanboard\Core;
use RuntimeException;
/**
* Router class
*
@@ -216,6 +218,10 @@ class Router extends Base
$class = '\Kanboard\\';
$class .= empty($plugin) ? 'Controller\\'.ucfirst($this->controller) : 'Plugin\\'.ucfirst($plugin).'\Controller\\'.ucfirst($this->controller);
if (! class_exists($class) || ! method_exists($class, $this->action)) {
throw new RuntimeException('Controller or method not found for the given url!');
}
$instance = new $class($this->container);
$instance->beforeAction($this->controller, $this->action);
$instance->{$this->action}();