mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 05:58:34 +01:00
webservice MDL-12886 exception more explicit when clean response value fail
This commit is contained in:
parent
fde884c342
commit
476c0e82d3
@ -76,6 +76,7 @@ $string['errormissingkey'] = 'Missing required key in single structure: {$a}';
|
||||
$string['errornotemptydefaultparamarray'] = 'The web service description parameter named \'{$a}\' is an single or multiple structure. The default can only be empty array. Check web service description.';
|
||||
$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['execute'] = 'Execute';
|
||||
|
@ -235,7 +235,7 @@ class external_api {
|
||||
foreach ($description->keys as $key=>$subdesc) {
|
||||
if (!array_key_exists($key, $response)) {
|
||||
if ($subdesc->required == VALUE_REQUIRED) {
|
||||
throw new invalid_response_exception(get_string('errormissingkey', 'webservice', $key));
|
||||
throw new webservice_parameter_exception('errorresponsemissingkey', $key);
|
||||
}
|
||||
if ($subdesc instanceof external_value) {
|
||||
if ($subdesc->required == VALUE_DEFAULT) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user