PcCustomErrorActionFilter
public function actionHandleErrors() { // log the error message first. $error = Yii::app()->errorHandler->error; // traces attribute is huge. Remove it to prevent inflation of log files unset($error['traces']); Yii::log("Fatal Error occurred! This was the reported error:\n" . var_export($error, true), CLogger::LEVEL_WARNING, __METHOD__); // return a uniform 'failure' message to the user's eagerly awaiting rowser. echo CJSON::encode(array('status' => 'failure')); }
public function filters() { return array( array( // be sure to update the path and also retain the '- methodName' ! 'application.components.PcCustomErrorActionFilter - handleErrors', // this is the 'route' to the error handling method. 'errorActionRoute' => 'moduleId/controllerId/handleErrors', ), ); }
Be the first person to leave a comment
Please login to leave your comment.