original_string: public function handle($exception) {
          $message = $exception->getMessage();
  
          // Add the exception backtrace for developers.
          if (debugging('', DEBUG_DEVELOPER)) {
              $message .= "\n".format_backtrace(get_exception_info($exception)->backtrace, true);
          }
  
          // Switch to response.
          $type = str_replace('Request', 'Response', $this->type);
  
          // Build the appropriate xml.
          $response = lti_get_response_xml('failure', $message, $this->id, $type);
  
          $xml = $response->asXML();
  
          // Log the request if necessary.
          if ($this->log) {
              lti_log_response($xml, $exception);
          }
  
          echo $xml;
      }
code: public function handle($exception) {
          $message = $exception->getMessage();
  
          // Add the exception backtrace for developers.
          if (debugging('', DEBUG_DEVELOPER)) {
              $message .= "\n".format_backtrace(get_exception_info($exception)->backtrace, true);
          }
  
          // Switch to response.
          $type = str_replace('Request', 'Response', $this->type);
  
          // Build the appropriate xml.
          $response = lti_get_response_xml('failure', $message, $this->id, $type);
  
          $xml = $response->asXML();
  
          // Log the request if necessary.
          if ($this->log) {
              lti_log_response($xml, $exception);
          }
  
          echo $xml;
      }
code_tokens: public function handle ( $ exception ) { $ message = $ exception -> getMessage ( ) ; // Add the exception backtrace for developers. if ( debugging ( '' , DEBUG_DEVELOPER ) ) { $ message .= "\n" . format_backtrace ( get_exception_info ( $ exception ) -> backtrace , true ) ; } // Switch to response. $ type = str_replace ( 'Request' , 'Response' , $ this -> type ) ; // Build the appropriate xml. $ response = lti_get_response_xml ( 'failure' , $ message , $ this -> id , $ type ) ; $ xml = $ response -> asXML ( ) ; // Log the request if necessary. if ( $ this -> log ) { lti_log_response ( $ xml , $ exception ) ; } echo $ xml ; }
docstring: Echo an exception message encapsulated in XML.
  
  @param \Exception|\Throwable $exception The exception that was thrown
docstring_tokens: Echo an exception message encapsulated in XML .