MDL-15352: add error management to mnet communication

This commit is contained in:
jerome 2008-10-27 05:12:32 +00:00
parent 4b31ac5cd1
commit a1c9c2bdc3
2 changed files with 10 additions and 2 deletions

View File

@ -9,4 +9,5 @@ $string['emptyfilelist'] = 'There are no files to show';
$string['remoterep_name'] = 'Remote Moodle Repository';
$string['remoterep_description'] = 'Allow the service to be discovered<br><br>';
$string['connectionfailure'] = 'Failed to retrieve file listing - The host moodle has either a version older than 2.0, either its Moodle Remote Repository service hasn\'t been activated';
$string['failtoretrievelist'] = 'List could not be retrieved or is empty';
$string['failtoretrievelist'] = 'List could not be retrieved or is empty';
$string['usernotfound'] = 'The user $a is not registered into the remote Moodle';

View File

@ -273,7 +273,14 @@ class repository_remotemoodle extends repository {
$client->add_param($USER->username);
$client->add_param($search);
$client->send($mnet_peer);
if (!$client->send($mnet_peer)) {
$message =" ";
foreach ($client->error as $errormessage) {
$message .= "ERROR: $errormessage . ";
}
echo json_encode(array('e'=>$message));
exit;
}
$services = $client->response;