/** * Constructor. * * @param array $config An optional KConfig object with configuration options. * * @return void */ public function __construct($errors = array(), $code = KHttpResponse::INTERNAL_SERVER_ERROR, Exception $previous = null) { foreach ($errors as $error) { $this->_errors[] = $error; } $message = KHttpResponse::getMessage($code); parent::__construct($message, $code, $previous); }
/** * Custom JError callback * * Push the exception call stack in the JException returned through the call back * adn then rener the custom error page * * @param object A JException object * @return void */ public function errorHandler($error) { if ($error instanceof Exception) { $exception = $error; $this->_exception = $exception; //store the exception for later use //Make sure we have a valid status code JError::raiseError(KHttpResponse::isError($exception->getCode()) ? $exception->getCode() : 500, $exception->getMessage()); return; } $error->setProperties(array('backtrace' => $this->_exception->getTrace(), 'file' => $this->_exception->getFile(), 'line' => $this->_exception->getLine())); $debug = version_compare(JVERSION, '3.0', 'ge') ? JFactory::getConfig()->get('debug') : JFactory::getConfig()->getValue('config.debug'); if ($debug) { $error->set('message', (string) $this->_exception); } else { $error->set('message', KHttpResponse::getMessage($error->get('code'))); } //Make sure the buffers are cleared while (@ob_get_clean()) { } JError::customErrorPage($error); }
/** * Custom JError callback * * Push the exception call stack in the JException returned through the call back * adn then rener the custom error page * * @param object A JException object * @return void */ public function errorHandler($error) { $error->setProperties(array('backtrace' => $this->_exception->getTrace(), 'file' => $this->_exception->getFile(), 'line' => $this->_exception->getLine())); if (JFactory::getConfig()->getValue('config.debug')) { $error->set('message', (string) $this->_exception); } else { $error->set('message', KHttpResponse::getMessage($error->get('code'))); } if ($this->_exception->getCode() == KHttpResponse::UNAUTHORIZED) { header('WWW-Authenticate: Basic Realm="' . KRequest::base() . '"'); } //Make sure the buffers are cleared while (@ob_get_clean()) { } JError::customErrorPage($error); }
/** * Custom JError callback * * Push the exception call stack in the JException returned through the call back * adn then rener the custom error page * * @param object A JException object * @return void */ public function errorHandler($error) { $error->setProperties(array( 'backtrace' => $this->_exception->getTrace(), 'file' => $this->_exception->getFile(), 'line' => $this->_exception->getLine() )); if(KFactory::get('joomla:config')->getValue('config.debug')) { $error->set('message', (string) $this->_exception); } else { $error->set('message', KHttpResponse::getMessage($error->code)); } //Make sure the buffers are cleared while(@ob_get_clean()); JError::customErrorPage($error); }
/** * Set the response status * * @param int $status The response status code * @param string $message The status message * * @return LibBaseControllerResponseAbstract */ public function setStatus($status, $message = null) { if (!$status) { throw new InvalidArgumentException('Response status is missing'); } if (!$message && !KHttpResponse::getMessage($status)) { throw new InvalidArgumentException('Response message is missing'); } $this->_status_code = $status; $this->_status_message = $message; }