Example #1
0
 public function errorAction()
 {
     $errors = $this->_getParam('error_handler');
     $error = array();
     switch ($errors->type) {
         case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER:
         case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION:
         case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_OTHER:
             $error = Pandamp_Error::fromException($errors->exception);
             break;
     }
     $this->getResponse()->clearBody();
     $this->view->success = false;
     $this->view->error = $error->getDto();
 }
Example #2
0
 /**
  * Creates a new instance of Anoa_Error based on the
  * passed exception.
  *
  * @param Exception $e Any exception that should be casted
  * to an instance of Anoa_Error
  *
  * @return Anoa_Error
  */
 public static function fromException(Exception $e, $errorClass = 'Pandamp_Error')
 {
     switch ($errorClass) {
         case 'Pandamp_Error':
             $error = new Pandamp_Error();
             break;
         case 'Pandamp_Error_Form':
             //$error = new Pandamp_Error_Form();
             break;
     }
     $error->setCode($e->getCode());
     $error->setMessage($e->getMessage());
     $error->setFile($e->getFile());
     $error->setLine($e->getLine());
     $error->setType(get_class($e));
     return $error;
 }