/** * Generate the response using the controller object. * * If there is no specific template for the raised error (normally there won't be one) * swallow the missing view exception and just use the standard * error format. This prevents throwing an unknown Exception and seeing instead * a MissingView exception * * @param string $template The template to render. * @return \Cake\Network\Response */ protected function _outputMessage($template) { $viewVars = ['success', 'data']; $this->controller->set('success', false); $this->controller->set('data', $this->_getErrorData()); if (Configure::read('debug')) { $queryLog = $this->_getQueryLog(); if ($queryLog) { $this->controller->set(compact('queryLog')); $viewVars[] = 'queryLog'; } } $this->controller->set('_serialize', $viewVars); return parent::_outputMessage($template); }