public function jsonErrorAction()
 {
     $errors = $this->getRequest()->getParam('error_handler');
     $exception = $errors->exception;
     if ($exception instanceof Kwf_Exception_Abstract) {
         $this->getResponse()->setRawHeader($exception->getHeader());
     } else {
         $this->getResponse()->setRawHeader('HTTP/1.1 500 Internal Server Error');
     }
     if ($exception instanceof Kwf_Exception_Client) {
         $this->view->error = $exception->getMessage();
     } else {
         if (!$exception instanceof Kwf_Exception_Abstract) {
             $exception = new Kwf_Exception_Other($exception);
         }
         $this->view->error = $exception->getMessage();
         if (!$this->view->error) {
             $this->view->error = 'An error occurred';
         }
         if (Kwf_Exception::isDebug()) {
             $this->view->exception = explode("\n", $exception->getException()->__toString());
         }
     }
     $exception->log();
 }