MDL-32949 ws: minor comments cleanup

This commit is contained in:
Eloy Lafuente (stronk7) 2012-05-15 13:10:50 +02:00
parent 4617939723
commit 5b0800d30e
2 changed files with 12 additions and 10 deletions

View File

@ -55,14 +55,14 @@ class moodle_zend_soap_server extends Zend_Soap_Server {
public function fault($fault = null, $code = "Receiver")
{
//run the zend code that clean/create a soapfault
// Run the zend code that clean/create a soapfault.
$soapfault = parent::fault($fault, $code);
//intercept any exceptions and add the errorcode and debuginfo (optional)
// Intercept any exceptions and add the errorcode and debuginfo (optional).
$actor = null;
$details = null;
if ($fault instanceof Exception) {
//add the debuginfo to the exception message if debuginfo must be returned
// Add the debuginfo to the exception message if debuginfo must be returned.
$actor = $fault->errorcode;
if (debugging() and isset($fault->debuginfo)) {
$details = $fault->debuginfo;
@ -75,10 +75,12 @@ class moodle_zend_soap_server extends Zend_Soap_Server {
}
/**
* Handle a request
*
* NOTE: this is basically a copy of the Zend handle()
* but with $soap->fault returning faultactor + faultdetail
*
* Handle a request
* So we don't require coding style checks within this method
* to keep it as similar as the original one.
*
* Instantiates SoapServer object with options set in object, and
* dispatches its handle() method.

View File

@ -48,17 +48,17 @@ class moodle_zend_xmlrpc_server extends Zend_XmlRpc_Server {
*/
public function fault($fault = null, $code = 404)
{
//intercept any exceptions with debug info and transform it in Moodle exception
// Intercept any exceptions with debug info and transform it in Moodle exception.
if ($fault instanceof Exception) {
// code php exception must be a long
// we obtain a hash of the errorcode, and then to get an integer hash
// Code php exception must be a long
// we obtain a hash of the errorcode, and then to get an integer hash.
$code = base_convert(md5($fault->errorcode), 16, 10);
// code php exception being a long, it has a maximum number of digits.
// Code php exception being a long, it has a maximum number of digits.
// we strip the $code to 8 digits, and hope for no error code collisions.
// Collisions should be pretty rare, and if needed the client can retrieve
// the accurate errorcode from the last | in the exception message.
$code = substr($code, 0, 8);
//add the debuginfo to the exception message if debuginfo must be returned
// Add the debuginfo to the exception message if debuginfo must be returned.
if (debugging() and isset($fault->debuginfo)) {
$fault = new Exception($fault->getMessage() . ' | DEBUG INFO: ' . $fault->debuginfo
. ' | ERRORCODE: ' . $fault->errorcode, $code);