/**
  *
  * @param \Yaf\Exception $exception   Yaf定义的异常类
  * @return boolean
  */
 public function errorAction($exception)
 {
     switch ($exception->getCode()) {
         case YAF\ERR\NOTFOUND\MODULE:
         case YAF\ERR\NOTFOUND\CONTROLLER:
         case YAF\ERR\NOTFOUND\ACTION:
         case YAF\ERR\NOTFOUND\VIEW:
         case 404:
             header('HTTP/1.1 404 Not Found');
             break;
         default:
             header('HTTP/1.1 500');
             break;
     }
     // 只有以开发环境下, 才会输出完整的错误信息, 线上环境只输出错误码.
     if ('develop' == \Yaf\Application::app()->environ()) {
         if ($this->getRequest()->isXmlHttpRequest()) {
             $data = array('code' => $exception->getCode(), 'file' => $exception->getFile(), 'errormsg' => $exception->getMessage(), 'line' => $exception->getLine(), 'traceAsString' => $exception->getTraceAsString());
             $this->jsonp($data, false, $exception->getCode(), $exception->getMessage(), $this->getCallbackName());
         } else {
             echo '<h1> Error No.: ', $exception->getCode(), '</h1>';
             echo '<h2>Message:</h2>';
             echo '<div>', $exception->getMessage(), '</div>';
             echo '<h2>File:</h2>';
             echo '<div>', $exception->getFile(), '</div>';
             echo '<h2>Line:</h2>';
             echo '<div>', $exception->getLine(), '</div>';
             echo '<h2>Trace:</h2>';
             echo '<pre>', $exception->getTraceAsString(), '</pre>';
         }
     } else {
         if ($this->getRequest()->isXmlHttpRequest()) {
             $this->jsonp(array('code' => $exception->getCode()), false, $exception->getCode(), '', $this->getCallbackName());
             exit;
         }
     }
 }