mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 00:12:56 +02:00
webservice MDL-25444 indicate which field are unexpected in case of web service error
This commit is contained in:
parent
a7a1dbd632
commit
ceb1bad4ad
@ -85,7 +85,7 @@ $string['erroronlyarray'] = 'Only arrays accepted.';
|
||||
$string['erroroptionalparamarray'] = 'The web service description parameter named \'{$a}\' is an single or multiple structure. It can not be set as VALUE_OPTIONAL. Check web service description.';
|
||||
$string['errorresponsemissingkey'] = 'Error in response - Missing following required key in a single structure: {$a}';
|
||||
$string['errorscalartype'] = 'Scalar type expected, array or object received.';
|
||||
$string['errorunexpectedkey'] = 'Unexpected keys detected in parameter array.';
|
||||
$string['errorunexpectedkey'] = 'Unexpected keys ({$a}) detected in parameter array.';
|
||||
$string['execute'] = 'Execute';
|
||||
$string['executewarnign'] = 'WARNING: If you press execute your database will be modified and changes can not be reverted automatically!';
|
||||
$string['externalservice'] = 'External service';
|
||||
|
@ -185,7 +185,12 @@ class external_api {
|
||||
unset($params[$key]);
|
||||
}
|
||||
if (!empty($params)) {
|
||||
throw new invalid_parameter_exception(get_string('errorunexpectedkey', 'webservice'));
|
||||
//list all unexpected keys
|
||||
$keys = '';
|
||||
foreach($params as $key => $value) {
|
||||
$keys .= $key . ',';
|
||||
}
|
||||
throw new invalid_parameter_exception(get_string('errorunexpectedkey', 'webservice', $keys));
|
||||
}
|
||||
return $result;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user