mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 08:26:37 +02:00
MDL-77799 webservice_rest: unhandled exception should go in server log
This commit is contained in:
parent
84bb5725f8
commit
6f48fe50a2
1 changed files with 9 additions and 0 deletions
|
@ -153,6 +153,15 @@ class webservice_rest_server extends webservice_base_server {
|
||||||
* @param exception $ex the exception that we are sending
|
* @param exception $ex the exception that we are sending
|
||||||
*/
|
*/
|
||||||
protected function send_error($ex=null) {
|
protected function send_error($ex=null) {
|
||||||
|
// Unless debugging is completely off, log the error to server error log.
|
||||||
|
if (debugging('', DEBUG_MINIMAL)) {
|
||||||
|
$info = get_exception_info($ex);
|
||||||
|
// This format is the same as default_exception_handler() in setuplib.php but with the
|
||||||
|
// word 'REST' instead of 'Default', to make it easy to reuse any existing processing.
|
||||||
|
error_log('REST exception handler: ' . $info->message . ' Debug: ' .
|
||||||
|
$info->debuginfo . "\n" . format_backtrace($info->backtrace, true));
|
||||||
|
}
|
||||||
|
|
||||||
$this->send_headers();
|
$this->send_headers();
|
||||||
echo $this->generate_error($ex);
|
echo $this->generate_error($ex);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue