webservice MDL-21511 display debug info when the exception return is invalid parameter type

This commit is contained in:
jerome mouneyrac
2010-02-05 06:30:47 +00:00
parent 13a3ebca7a
commit e5752b7d5b
+3 -2
View File
@@ -164,7 +164,7 @@ class external_api {
foreach ($description->keys as $key=>$subdesc) {
if (!array_key_exists($key, $params)) {
if ($subdesc->required == VALUE_REQUIRED) {
throw new invalid_parameter_exception('Missing required key in single structure.');
throw new invalid_parameter_exception('Missing required key in single structure: '.$key);
}
if ($subdesc instanceof external_value) {
if ($subdesc->required == VALUE_DEFAULT) {
@@ -179,7 +179,8 @@ class external_api {
try {
$result[$key] = self::validate_parameters($subdesc, $params[$key]);
} catch (invalid_parameter_exception $e) {
throw new webservice_parameter_exception('invalidextparam',$key);
//it's ok to display debug info as here the information is useful for ws client/dev
throw new webservice_parameter_exception('invalidextparam',$key." (".$e->debuginfo.")");
}
}
unset($params[$key]);