Throw exception for page not found
This commit is contained in:
parent
8c532efd5f
commit
3543f45c2d
|
|
@ -49,10 +49,6 @@ use Pimple\Container;
|
|||
* @property \Kanboard\Model\File $file
|
||||
* @property \Kanboard\Model\LastLogin $lastLogin
|
||||
* @property \Kanboard\Model\Link $link
|
||||
* @property \Kanboard\Model\UserNotification $userNotification
|
||||
* @property \Kanboard\Model\UserNotificationType $userNotificationType
|
||||
* @property \Kanboard\Model\UserNotificationFilter $userNotificationFilter
|
||||
* @property \Kanboard\Model\UserUnreadNotification $userUnreadNotification
|
||||
* @property \Kanboard\Model\OverdueNotification $overdueNotification
|
||||
* @property \Kanboard\Model\Project $project
|
||||
* @property \Kanboard\Model\ProjectActivity $projectActivity
|
||||
|
|
@ -71,6 +67,7 @@ use Pimple\Container;
|
|||
* @property \Kanboard\Model\TaskCreation $taskCreation
|
||||
* @property \Kanboard\Model\TaskDuplication $taskDuplication
|
||||
* @property \Kanboard\Model\TaskExport $taskExport
|
||||
* @property \Kanboard\Model\TaskImport $taskImport
|
||||
* @property \Kanboard\Model\TaskFinder $taskFinder
|
||||
* @property \Kanboard\Model\TaskFilter $taskFilter
|
||||
* @property \Kanboard\Model\TaskLink $taskLink
|
||||
|
|
@ -81,6 +78,11 @@ use Pimple\Container;
|
|||
* @property \Kanboard\Model\TaskValidator $taskValidator
|
||||
* @property \Kanboard\Model\Transition $transition
|
||||
* @property \Kanboard\Model\User $user
|
||||
* @property \Kanboard\Model\UserImport $userImport
|
||||
* @property \Kanboard\Model\UserNotification $userNotification
|
||||
* @property \Kanboard\Model\UserNotificationType $userNotificationType
|
||||
* @property \Kanboard\Model\UserNotificationFilter $userNotificationFilter
|
||||
* @property \Kanboard\Model\UserUnreadNotification $userUnreadNotification
|
||||
* @property \Kanboard\Model\UserSession $userSession
|
||||
* @property \Kanboard\Model\Webhook $webhook
|
||||
* @property \Psr\Log\LoggerInterface $logger
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ namespace Kanboard\Core\Plugin;
|
|||
|
||||
use DirectoryIterator;
|
||||
use PDOException;
|
||||
use RuntimeException;
|
||||
use Kanboard\Core\Tool;
|
||||
|
||||
/**
|
||||
|
|
@ -111,7 +112,7 @@ class Loader extends \Kanboard\Core\Base
|
|||
} catch (PDOException $e) {
|
||||
$this->db->cancelTransaction();
|
||||
$this->db->getDriver()->enableForeignKeys();
|
||||
die('Unable to migrate schema for the plugin: '.$plugin.' => '.$e->getMessage());
|
||||
throw new RuntimeException('Unable to migrate schema for the plugin: '.$plugin.' => '.$e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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}();
|
||||
|
|
|
|||
|
|
@ -2,4 +2,8 @@
|
|||
|
||||
require __DIR__.'/app/common.php';
|
||||
|
||||
$container['router']->dispatch($_SERVER['REQUEST_URI'], isset($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : '');
|
||||
try {
|
||||
$container['router']->dispatch($_SERVER['REQUEST_URI'], isset($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : '');
|
||||
} catch (Exception $e) {
|
||||
echo 'Internal Error: '.$e->getMessage();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue