Added 'InvalidURI' error + made it possible for 'ModuleError' to have an argument description

This commit is contained in:
xdrm-brackets 2017-12-10 20:52:23 +01:00
parent da3d3678eb
commit 8fc2f7f614
2 changed files with 22 additions and 14 deletions

View File

@ -63,6 +63,8 @@
const WrongParam = 17;
/* (12) Erreur dans le traitement */
const ModuleError = 18;
/* (13) URI Invalide */
const InvalidURI = 19;
/* [5] Database
@ -70,50 +72,50 @@
/* (1) Base de données
---------------------------------------------------------*/
/* (1) Erreur lors de la creation d'un objet PDO (connection) */
const PDOConnection = 19;
const PDOConnection = 20;
/* (2) Repositories
---------------------------------------------------------*/
/* (1) Verification de la coherence du chemin (existe dans la conf) */
const WrongPathRepo = 20;
const WrongPathRepo = 21;
/* (2) Module non specifie dans la conf */
const UnknownRepo = 21;
const UnknownRepo = 22;
/* (3) Erreur dans le traitement */
const RepoError = 22;
const RepoError = 23;
/* (3) ORM
---------------------------------------------------------*/
/* (1) Table n'existe pas */
const UnknownTable = 23;
const UnknownTable = 24;
/* (2) Pas permissions de lire le schéma */
const NotAllowedSchema = 24;
const NotAllowedSchema = 25;
/* [6] Erreurs diverses
=========================================================*/
/* (1) Aucune donnée trouvée */
const NoMatchFound = 25;
const NoMatchFound = 26;
/* (2) Mauvais chemin de template */
const UnknownTemplate = 26;
const UnknownTemplate = 27;
/* (3) géolocalisation échouée */
const UnknownAddress = 27;
const UnknownAddress = 28;
/* (4) Erreur inconnue */
const UnknownError = 28;
const UnknownError = 29;
/* (5) Entrée existante */
const AlreadyExists = 29;
const AlreadyExists = 30;
/* (6) Corps manquant */
const MissingBody = 30;
const MissingBody = 31;
/* (7) Header manquant */
const MissingHeaders = 31;
const MissingHeaders = 32;
}
?>

View File

@ -78,6 +78,7 @@
case Err::MissingParam: return $this->MissingParam(); break;
case Err::WrongParam: return $this->WrongParam(); break;
case Err::ModuleError: return $this->ModuleError(); break;
case Err::InvalidURI: return $this->InvalidURI(); break;
case Err::PDOConnection: return $this->PDOConnection(); break;
case Err::WrongPathRepo: return $this->WrongPathRepo(); break;
case Err::UnknownRepo: return $this->UnknownRepo(); break;
@ -161,7 +162,12 @@
else
return 'wrong param';
}private function ModuleError(){
return 'module error';
if( count($this->arguments) > 0 )
return 'module error: \''.$this->arguments[0].'\'';
else
return 'module error';
}private function InvalidURI(){
return 'invalid URI';
}private function PDOConnection(){
return 'database error';
}private function WrongPathRepo(){