/**
  * Renders the response for the exception.
  *
  * @return \Cake\Network\Response The response to be sent.
  */
 public function render()
 {
     $exception = $this->error;
     $code = $this->_code($exception);
     $method = $this->_method($exception);
     $template = $this->_template($exception, $method, $code);
     $isDebug = Configure::read('debug');
     if (($isDebug || $exception instanceof HttpException) && method_exists($this, $method)) {
         return $this->_customMethod($method, $exception);
     }
     $message = $this->_message($exception, $code);
     $url = $this->controller->request->here();
     if (method_exists($exception, 'responseHeader')) {
         $this->controller->response->header($exception->responseHeader());
     }
     $this->controller->response->statusCode($code);
     $viewVars = ['message' => $message, 'url' => h($url), 'error' => $exception, 'code' => $code, '_serialize' => ['message', 'url', 'code']];
     if ($isDebug) {
         $viewVars['trace'] = Debugger::formatTrace($exception->getTrace(), ['format' => 'array', 'args' => false]);
         $viewVars['_serialize'][] = 'trace';
     }
     $this->controller->set($viewVars);
     if ($exception instanceof CakeException && $isDebug) {
         $this->controller->set($this->error->getAttributes());
     }
     return $this->_outputMessage($template);
 }
 /**
  * Renders the response for the exception.
  *
  * @return \Cake\Network\Response The response to be sent.
  */
 public function render()
 {
     $exception = $this->error;
     $code = $this->_code($exception);
     $method = $this->_method($exception);
     $template = $this->_template($exception, $method, $code);
     $isDebug = Configure::read('debug');
     if (($isDebug || $exception instanceof HttpException) && method_exists($this, $method)) {
         return $this->_customMethod($method, $exception);
     }
     $message = $this->_message($exception, $code);
     $url = $this->controller->request->here();
     if (method_exists($exception, 'responseHeader')) {
         $this->controller->response->header($exception->responseHeader());
     }
     $this->controller->response->statusCode($code);
     $this->controller->set(array('message' => $message, 'url' => h($url), 'error' => $exception, 'code' => $code, '_serialize' => array('message', 'url', 'code')));
     if ($exception instanceof CakeException && $isDebug) {
         $this->controller->set($this->error->getAttributes());
     }
     return $this->_outputMessage($template);
 }