Example #1
0
 /**
  * @return ExceptionHandlerInterface
  */
 public function getExceptionHandler()
 {
     if (null === $this->exceptionHandler) {
         $this->exceptionHandler = new DefaultExceptionHandler($this->getPsr7Factory(), $this->getErrorPageLoader());
         if ($this->exceptionHandler instanceof LoggerAwareInterface) {
             $this->exceptionHandler->setLogger($this->getLogger());
         }
     }
     return $this->exceptionHandler;
 }
Example #2
0
 /**
  * @param \Exception $ex
  *
  * @throws \Exception
  *
  * @return ResponseInterface|null
  */
 private function handleException(\Exception $ex)
 {
     if (null !== ($response = $this->handleInternalException($ex))) {
         $this->logException($ex);
         return $response;
     }
     try {
         $this->exceptionHandler->handle($ex);
     } catch (\Exception $ex) {
         if (null !== ($response = $this->handleInternalException($ex))) {
             return $response;
         }
     }
     throw $ex;
 }