src/wcmf/lib/presentation/Application.php
public function handleException(\Exception $exception) {
    // get error level
    $logFunction = 'error';
    if ($exception instanceof ApplicationException) {
      $logFunction = $exception->getError()->getLevel() == ApplicationError::LEVEL_WARNING ?
              'warn' : 'error';
    }
    self::$logger->$logFunction($exception);

    try {
      if (ObjectFactory::getInstance('configuration') != null) {
        // rollback current transaction
        $persistenceFacade = ObjectFactory::getInstance('persistenceFacade');
        $persistenceFacade->getTransaction()->rollback();

        // redirect to failure action
        if ($this->request) {
          $error = ApplicationError::fromException($exception);
          $this->request->addError($error);
          $this->response->addError($error);
          $this->request->setAction('failure');
          $this->response->setAction('failure');
          $this->response->setStatus($error->getStatusCode());
          ObjectFactory::getInstance('actionMapper')->processAction($this->request, $this->response);
          return;
        }
      }
      throw $exception;
    }
    catch (\Exception $ex) {
      self::$logger->error($ex->getMessage()."\n".$ex->getTraceAsString());
    }
  }
public function handleException(\Exception $exception) {
    // get error level
    $logFunction = 'error';
    if ($exception instanceof ApplicationException) {
      $logFunction = $exception->getError()->getLevel() == ApplicationError::LEVEL_WARNING ?
              'warn' : 'error';
    }
    self::$logger->$logFunction($exception);

    try {
      if (ObjectFactory::getInstance('configuration') != null) {
        // rollback current transaction
        $persistenceFacade = ObjectFactory::getInstance('persistenceFacade');
        $persistenceFacade->getTransaction()->rollback();

        // redirect to failure action
        if ($this->request) {
          $error = ApplicationError::fromException($exception);
          $this->request->addError($error);
          $this->response->addError($error);
          $this->request->setAction('failure');
          $this->response->setAction('failure');
          $this->response->setStatus($error->getStatusCode());
          ObjectFactory::getInstance('actionMapper')->processAction($this->request, $this->response);
          return;
        }
      }
      throw $exception;
    }
    catch (\Exception $ex) {
      self::$logger->error($ex->getMessage()."\n".$ex->getTraceAsString());
    }
  }
public function handleException ( \ Exception $ exception ) { // get error level $ logFunction = 'error' ; if ( $ exception instanceof ApplicationException ) { $ logFunction = $ exception -> getError ( ) -> getLevel ( ) == ApplicationError :: LEVEL_WARNING ? 'warn' : 'error' ; } self :: $ logger -> $ logFunction ( $ exception ) ; try { if ( ObjectFactory :: getInstance ( 'configuration' ) != null ) { // rollback current transaction $ persistenceFacade = ObjectFactory :: getInstance ( 'persistenceFacade' ) ; $ persistenceFacade -> getTransaction ( ) -> rollback ( ) ; // redirect to failure action if ( $ this -> request ) { $ error = ApplicationError :: fromException ( $ exception ) ; $ this -> request -> addError ( $ error ) ; $ this -> response -> addError ( $ error ) ; $ this -> request -> setAction ( 'failure' ) ; $ this -> response -> setAction ( 'failure' ) ; $ this -> response -> setStatus ( $ error -> getStatusCode ( ) ) ; ObjectFactory :: getInstance ( 'actionMapper' ) -> processAction ( $ this -> request , $ this -> response ) ; return ; } } throw $ exception ; } catch ( \ Exception $ ex ) { self :: $ logger -> error ( $ ex -> getMessage ( ) . "\n" . $ ex -> getTraceAsString ( ) ) ; } }
Default exception handling method. Rolls back the transaction and
executes 'failure' action.
@param $exception The Exception instance
Default exception handling method . Rolls back the transaction and executes failure action .