Ejemplo n.º 1
0
 /**
  * Ask our exception handler to handle the exception.  Return the
  * <code>ActionForward</code> instance (if any) returned by the
  * called <code>ExceptionHandler</code>.
  *
  * @param \Symfony\Component\HttpFoundation\Request $request The kernel request we are processing
  * @param \Symfony\Component\HttpFoundation\Response response The kernel response we are processing
  * @param \Exception exception The exception being handled
  * @param \Phruts\Action\AbstractActionForm form The ActionForm we are processing
  * @param \Phruts\Config\ActionConfig mapping The ActionMapping we are using
  *
  * @return \Phruts\Action\ActionForward
  * @exception IOException if an input/output error occurs
  * @exception kernelException if a kernel exception occurs
  */
 protected function processException(\Symfony\Component\HttpFoundation\Request $request, \Symfony\Component\HttpFoundation\Response $response, \Exception $exception, $form, \Phruts\Action\ActionMapping $mapping)
 {
     // Is there a defined handler for this exception?
     $config = $mapping->findExceptionConfig(get_class($exception));
     // ExceptionConfig
     if ($config == null) {
         // Check the module config for a global exception
         if (!empty($this->log)) {
             $this->log->debug($this->getInternal()->getMessage(null, 'nonactionException', get_class($exception)));
         }
         $config = $mapping->getModuleConfig()->findExceptionConfig(get_class($exception));
     }
     if ($config == null) {
         // There is no configuration for this exception
         if (!empty($this->log)) {
             $this->log->debug($this->getInternal()->getMessage(null, 'unhandledException', get_class($exception)));
         }
         // Throw the error
         throw $exception;
     }
     // Use the configured exception handling
     try {
         $handler = \Phruts\Util\ClassLoader::newInstance($config->getHandler(), '\\Phruts\\Action\\ExceptionHandler');
         //ExceptionHandler
         return $handler->execute($exception, $config, $mapping, $form, $request, $response);
     } catch (\Exception $e) {
         throw new \Phruts\Exception($e);
     }
 }