Mr_T
(Mr. T)
December 19, 2011, 11:08am
1
Hello!
I want to throw an exception if a user is banned or a website is off. I tried realized it in beforeAction method in Controller class, but I have a problem. When I write
throw new CHttpException(403, 'Forbidden');
I give next
CHttpException
Forbidden (Z:\home\localhost\www\website\protected\components\Controller.php:56)
#0 Z:\home\localhost\www\yii-1.1.8.r3324\framework\web\CController.php(298): Controller->beforeAction(Object(CInlineAction))
#1 Z:\home\localhost\www\yii-1.1.8.r3324\framework\web\CController.php(278): CController->runAction(Object(CInlineAction))
#2 Z:\home\localhost\www\yii-1.1.8.r3324\framework\web\CController.php(257): CController->runActionWithFilters(Object(CInlineAction), Array)
#3 Z:\home\localhost\www\yii-1.1.8.r3324\framework\web\CWebApplication.php(277): CController->run(‘error’)
#4 Z:\home\localhost\www\yii-1.1.8.r3324\framework\base\CErrorHandler.php(280): CWebApplication->runController(‘gallery/error’)
#5 Z:\home\localhost\www\yii-1.1.8.r3324\framework\base\CErrorHandler.php(181): CErrorHandler->render(‘error’, Array)
#6 Z:\home\localhost\www\yii-1.1.8.r3324\framework\base\CErrorHandler.php(104): CErrorHandler->handleException(Object(CHttpException))
#7 Z:\home\localhost\www\yii-1.1.8.r3324\framework\base\CApplication.php(709): CErrorHandler->handle(Object(CExceptionEvent))
#8 [internal function]: CApplication->handleException(Object(CHttpException))
#9 {main}
. I will be happy, if somebody can help me…
Mr_T
(Mr. T)
December 20, 2011, 2:39pm
2
I don’t believe that nobody don’t know and never encountered with it…
Go out of debug mode. That should fix it.