From 6e0338629774fffe5fbe7136dfce34ce83844a5c Mon Sep 17 00:00:00 2001 From: xue <> Date: Tue, 30 May 2006 03:26:33 +0000 Subject: Blog demo is completed. --- demos/blog/protected/Common/BlogErrorHandler.php | 46 ++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 demos/blog/protected/Common/BlogErrorHandler.php (limited to 'demos/blog/protected/Common/BlogErrorHandler.php') diff --git a/demos/blog/protected/Common/BlogErrorHandler.php b/demos/blog/protected/Common/BlogErrorHandler.php new file mode 100644 index 00000000..6dab2a29 --- /dev/null +++ b/demos/blog/protected/Common/BlogErrorHandler.php @@ -0,0 +1,46 @@ + + * @link http://www.pradosoft.com/ + * @copyright Copyright © 2006 PradoSoft + * @license http://www.pradosoft.com/license/ + * @version $Revision: $ $Date: $ + */ + +Prado::using('System.Exceptions.TErrorHandler'); +Prado::using('Application.Common.BlogException'); + +/** + * BlogErrorHandler class + * + * @author Qiang Xue + * @link http://www.pradosoft.com/ + * @copyright Copyright © 2006 PradoSoft + * @license http://www.pradosoft.com/license/ + */ +class BlogErrorHandler extends TErrorHandler +{ + /** + * Displays error to the client user. + * THttpException and errors happened when the application is in Debug + * mode will be displayed to the client user. + * @param integer response status code + * @param Exception exception instance + */ + protected function handleExternalError($statusCode,$exception) + { + if($exception instanceof BlogException) + { + $message=$exception->getMessage(); + Prado::log($message,TLogger::ERROR,'BlogApplication'); + $message=urldecode($this->getApplication()->getSecurityManager()->hashData($message)); + $this->Response->redirect($this->Service->constructUrl('ErrorReport',array('msg'=>$message))); + } + else + parent::handleExternalError($statusCode,$exception); + } +} + +?> \ No newline at end of file -- cgit v1.2.3