/** * Instanciate a controller from a name. * * @param string $controllerClass * @param \Puzzlout\Framework\Core\Route $route * @return \Puzzlout\Framework\Controllers\BaseController * @throws \Exception : when the controller class can't be instanciated. */ protected function InstanciateController($controllerClass, Route $route) { try { return new $controllerClass($this, $route->module(), $route->action()); } catch (\Exception $exc) { $this->error->LogError($exc); throw new \Exception("Controller not loaded", Enums\ErrorCodes\FrameworkControllerConstants::ControllerNotLoadedValue, $exc); } }