Added error arguments to serialized version (json)
This commit is contained in:
parent
9dbbc1e3dc
commit
2b698e56f5
|
@ -109,7 +109,8 @@
|
||||||
// On rajoute l'erreur au message
|
// On rajoute l'erreur au message
|
||||||
$returnData = array_merge([
|
$returnData = array_merge([
|
||||||
'error' => $this->error->get(),
|
'error' => $this->error->get(),
|
||||||
'ErrorDescription' => $this->error->explicit()
|
'ErrorDescription' => $this->error->explicit(),
|
||||||
|
'ErrorArguments' => $this->error->args()
|
||||||
],
|
],
|
||||||
$this->data
|
$this->data
|
||||||
);
|
);
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
class Error{
|
class Error{
|
||||||
|
|
||||||
private $error = null;
|
private $error = null;
|
||||||
private $arguments = [];
|
private $args = [];
|
||||||
|
|
||||||
/* ERROR CONSTRUCTOR
|
/* ERROR CONSTRUCTOR
|
||||||
*
|
*
|
||||||
|
@ -48,7 +48,7 @@
|
||||||
$this->error = !is_numeric($const) ? Err::UnknownError : $const;
|
$this->error = !is_numeric($const) ? Err::UnknownError : $const;
|
||||||
|
|
||||||
/* (2) On récupère les arguments */
|
/* (2) On récupère les arguments */
|
||||||
$this->arguments = array_slice(func_get_args(), 1);
|
$this->args = array_slice(func_get_args(), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -98,8 +98,8 @@
|
||||||
private function Success(){
|
private function Success(){
|
||||||
return 'all right';
|
return 'all right';
|
||||||
}private function ParsingFailed(){
|
}private function ParsingFailed(){
|
||||||
if( count($this->arguments) > 0 )
|
if( count($this->args) > 0 )
|
||||||
return "{$this->arguments[0]} parsing failed";
|
return "{$this->args[0]} parsing failed";
|
||||||
else
|
else
|
||||||
return 'parsing failed';
|
return 'parsing failed';
|
||||||
}private function UnreachableResource(){
|
}private function UnreachableResource(){
|
||||||
|
@ -119,23 +119,23 @@
|
||||||
}private function WrongPathModule(){
|
}private function WrongPathModule(){
|
||||||
return 'wrong module\'s path';
|
return 'wrong module\'s path';
|
||||||
}private function UnknownModule(){
|
}private function UnknownModule(){
|
||||||
if( count($this->arguments) > 0 )
|
if( count($this->args) > 0 )
|
||||||
return "unknown module '{$this->arguments[0]}'";
|
return "unknown module '{$this->args[0]}'";
|
||||||
else
|
else
|
||||||
return 'unknown module';
|
return 'unknown module';
|
||||||
}private function UnknownMethod(){
|
}private function UnknownMethod(){
|
||||||
if( count($this->arguments) > 0 )
|
if( count($this->args) > 0 )
|
||||||
return "unknown method '{$this->arguments[0]}'";
|
return "unknown method '{$this->args[0]}'";
|
||||||
else
|
else
|
||||||
return 'unknown method';
|
return 'unknown method';
|
||||||
}private function UncallableModule(){
|
}private function UncallableModule(){
|
||||||
if( count($this->arguments) > 0 )
|
if( count($this->args) > 0 )
|
||||||
return "uncallable module '{$this->arguments[0]}'";
|
return "uncallable module '{$this->args[0]}'";
|
||||||
else
|
else
|
||||||
return 'uncallable module';
|
return 'uncallable module';
|
||||||
}private function UncallableMethod(){
|
}private function UncallableMethod(){
|
||||||
if( count($this->arguments) > 0 )
|
if( count($this->args) > 0 )
|
||||||
return "uncallable method '{$this->arguments[0]}'";
|
return "uncallable method '{$this->args[0]}'";
|
||||||
else
|
else
|
||||||
return 'uncallable method';
|
return 'uncallable method';
|
||||||
}private function UnknownHttpMethod(){
|
}private function UnknownHttpMethod(){
|
||||||
|
@ -143,16 +143,16 @@
|
||||||
}private function ConfigError(){
|
}private function ConfigError(){
|
||||||
return 'configuration error';
|
return 'configuration error';
|
||||||
}private function MissingParam(){
|
}private function MissingParam(){
|
||||||
if( count($this->arguments) > 0 )
|
if( count($this->args) > 0 )
|
||||||
return "missing param '{$this->arguments[0]}'";
|
return "missing param '{$this->args[0]}'";
|
||||||
else
|
else
|
||||||
return 'missing param';
|
return 'missing param';
|
||||||
}private function WrongParam(){
|
}private function WrongParam(){
|
||||||
if( count($this->arguments) > 0 )
|
if( count($this->args) > 0 )
|
||||||
if( count($this->arguments) > 1 )
|
if( count($this->args) > 1 )
|
||||||
return "wrong param '{$this->arguments[0]}' expected to be of type '{$this->arguments[1]}'";
|
return "wrong param '{$this->args[0]}' expected to be of type '{$this->args[1]}'";
|
||||||
else
|
else
|
||||||
return "wrong param '{$this->arguments[0]}'";
|
return "wrong param '{$this->args[0]}'";
|
||||||
else
|
else
|
||||||
return 'wrong param';
|
return 'wrong param';
|
||||||
}private function ModuleError(){
|
}private function ModuleError(){
|
||||||
|
@ -180,15 +180,15 @@
|
||||||
}private function UnknownDebugError(){
|
}private function UnknownDebugError(){
|
||||||
return 'unknown debug error';
|
return 'unknown debug error';
|
||||||
}private function AlreadyExists(){
|
}private function AlreadyExists(){
|
||||||
if( count($this->arguments) > 0 )
|
if( count($this->args) > 0 )
|
||||||
return "'{$this->arguments[0]}' already exists";
|
return "'{$this->args[0]}' already exists";
|
||||||
|
|
||||||
return 'entry already exists';
|
return 'entry already exists';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function args(){
|
public function args(){
|
||||||
return $this->arguments;
|
return $this->args;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue