本文整理汇总了PHP中Engine_Api::getErrorCode方法的典型用法代码示例。如果您正苦于以下问题:PHP Engine_Api::getErrorCode方法的具体用法?PHP Engine_Api::getErrorCode怎么用?PHP Engine_Api::getErrorCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Engine_Api
的用法示例。
在下文中一共展示了Engine_Api::getErrorCode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: errorAction
public function errorAction()
{
$error = $this->_getParam('error_handler');
$this->view->error_code = $error_code = Engine_Api::getErrorCode(true);
// Handle missing pages
switch ($error->type) {
case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER:
case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION:
return $this->_forward('notfound');
break;
default:
break;
}
// Log this message
if (isset($error->exception) && Zend_Registry::isRegistered('Zend_Log') && ($log = Zend_Registry::get('Zend_Log')) instanceof Zend_Log) {
// Only log if in production or the exception is not an instance of Engine_Exception
$e = $error->exception;
if ('production' === APPLICATION_ENV || !$e instanceof Engine_Exception) {
$output = '';
$output .= PHP_EOL . 'Error Code: ' . $error_code . PHP_EOL;
$output .= $e->__toString();
$log->log($output, Zend_Log::CRIT);
}
}
//$this->getResponse()->setRawHeader('HTTP/1.1 500 Internal server error');
$this->view->status = false;
$this->view->errorName = get_class($error->exception);
if (APPLICATION_ENV != 'production') {
if ($error->exception instanceof Exception) {
$this->view->error = $error->exception->__toString();
}
} else {
$this->view->message = Zend_Registry::get('Zend_Translate')->_('An error has occurred');
}
}