detailed loop error

This commit is contained in:
Etienne Roudeix
2013-08-02 13:39:05 +02:00
parent 866c29adb4
commit e8a6d9c900

View File

@@ -117,6 +117,9 @@ abstract class BaseLoop
$faultActor = array(); $faultActor = array();
$faultDetails = array(); $faultDetails = array();
$loopType = isset($nameValuePairs['type']) ? $nameValuePairs['type'] : "undefined";
$loopName = isset($nameValuePairs['name']) ? $nameValuePairs['name'] : "undefined";
while (($argument = $this->args->current()) !== false) { while (($argument = $this->args->current()) !== false) {
$this->args->next(); $this->args->next();
@@ -125,17 +128,17 @@ abstract class BaseLoop
/* check if mandatory */ /* check if mandatory */
if($value === null && $argument->mandatory) { if($value === null && $argument->mandatory) {
$faultActor[] = $argument->name; $faultActor[] = $argument->name;
$faultDetails[] = sprintf('"%s" parameter is missing', $argument->name); $faultDetails[] = sprintf('"%s" parameter is missing in loop type: %s, name: %s', $argument->name, $loopType, $loopName);
} }
else if($value === '' && !$argument->empty) { else if($value === '' && !$argument->empty) {
/* check if empty */ /* check if empty */
$faultActor[] = $argument->name; $faultActor[] = $argument->name;
$faultDetails[] = sprintf('"%s" parameter cannot be empty', $argument->name); $faultDetails[] = sprintf('"%s" parameter cannot be empty in loop type: %s, name: %s', $argument->name, $loopType, $loopName);
} }
else if($value !== null && !$argument->type->isValid($value)) { else if($value !== null && !$argument->type->isValid($value)) {
/* check type */ /* check type */
$faultActor[] = $argument->name; $faultActor[] = $argument->name;
$faultDetails[] = sprintf('Invalid value for "%s" argument', $argument->name); $faultDetails[] = sprintf('Invalid value for "%s" argument in loop type: %s, name: %s', $argument->name, $loopType, $loopName);
} }
else { else {
/* set default */ /* set default */