diff --git a/agents/ToplevelAgent.inc b/agents/ToplevelAgent.inc index af98c3d2..c545975a 100644 --- a/agents/ToplevelAgent.inc +++ b/agents/ToplevelAgent.inc @@ -116,17 +116,20 @@ try { return $this->_run($request, $response); } - catch(ParamsNotValidException $e) { - $this->error($e, WebUtils::HTTP_NOT_FOUND, self::STAGE_RUN); + catch(\nre\exceptions\AccessDeniedException $e) { + $this->error($e, \nre\core\WebUtils::HTTP_FORBIDDEN, self::STAGE_RUN); } - catch(IdNotFoundException $e) { - $this->error($e, WebUtils::HTTP_NOT_FOUND, self::STAGE_RUN); + catch(\nre\exceptions\ParamsNotValidException $e) { + $this->error($e, \nre\core\WebUtils::HTTP_NOT_FOUND, self::STAGE_RUN); } - catch(DatamodelException $e) { - $this->error($e, WebUtils::HTTP_SERVICE_UNAVAILABLE, self::STAGE_RUN); + catch(\nre\exceptions\IdNotFoundException $e) { + $this->error($e, \nre\core\WebUtils::HTTP_NOT_FOUND, self::STAGE_RUN); } - catch(ActionNotFoundException $e) { - $this->error($e, WebUtils::HTTP_NOT_FOUND, self::STAGE_RUN); + catch(\nre\exceptions\DatamodelException $e) { + $this->error($e, \nre\core\WebUtils::HTTP_SERVICE_UNAVAILABLE, self::STAGE_RUN); + } + catch(\nre\exceptions\ActionNotFoundException $e) { + $this->error($e, \nre\core\WebUtils::HTTP_NOT_FOUND, self::STAGE_RUN); } } @@ -173,8 +176,8 @@ func_get_args() ); } - catch(DatamodelException $e) { - throw new FatalDatamodelException($e->getDatamodelMessage(), $e->getDatamodelErrorNumber()); + catch(\nre\exceptions\DatamodelException $e) { + throw new \nre\exceptions\FatalDatamodelException($e->getDatamodelMessage(), $e->getDatamodelErrorNumber()); } } diff --git a/apis/WebApi.inc b/apis/WebApi.inc index 5d4ac7cd..28896a30 100644 --- a/apis/WebApi.inc +++ b/apis/WebApi.inc @@ -60,7 +60,7 @@ $this->errorService($e); } catch(\nre\exceptions\ActionNotFoundException $e) { - $this->error($e, WebUtils::HTTP_NOT_FOUND); + $this->error($e, \nre\core\WebUtils::HTTP_NOT_FOUND); } catch(\nre\exceptions\FatalDatamodelException $e) { $this->errorService($e); diff --git a/core/Model.inc b/core/Model.inc index 2906c404..c0475b4a 100644 --- a/core/Model.inc +++ b/core/Model.inc @@ -74,7 +74,7 @@ */ private static function getClassName($modelName) { - $className = \nre\core\ClassLoader::concatClassNames($modelName, \nre\core\ClassLoader::stripNamespace(get_class())); + $className = ClassLoader::concatClassNames($modelName, ClassLoader::stripNamespace(get_class())); return \nre\configs\AppConfig::$app['namespace']."models\\$className"; @@ -131,7 +131,8 @@ Model::load($model); // Construct Model - $this->$model = Model::factory($model); + $modelName = ucfirst(strtolower($model)); + $this->$modelName = Model::factory($model); } }