-
Improvement
-
Resolution: Fixed
-
Blocker
-
2.3
-
None
-
MOODLE_23_STABLE
-
MOODLE_23_STABLE
-
Add error code in REST/SOAP/...
example REST-XML:
<?xml version="1.0" encoding="UTF-8"?>
|
<EXCEPTION class="moodle_exception">
|
<ERRORCODE>missingcourse</ERRORCODE>
|
<MESSAGE>This is a not translated message</MESSAGE>
|
<DEBUGINFO>This is a not translated message with more detailled info</DEBUGINFO>
|
</EXCEPTION>
|
example SOAP change in webservice/soap/locallib.php:
public function fault($fault = null, $code = "Receiver")
|
{
|
//intercept any exceptions with debug info and transform it in Moodle exception
|
if ($fault instanceof Exception) {
|
//add the debuginfo to the exception message if debuginfo must be returned
|
if (debugging() and isset($fault->debuginfo)) {
|
$fault = new SoapFault($fault->errorcode, $fault->getMessage() . ' | DEBUG INFO: ' . $fault->debuginfo); //HERE IS THE CHANGE $fault->errorcode PS: NOT TESTED ;)
|
}
|
}
|
|
return parent::fault($fault, $code);
|
}
|