Autarky\Errors\ErrorHandlerInterface::handle PHP Method

handle() public method

Handle an exception.
public handle ( Exception $exception ) : Response
$exception Exception
return Symfony\Component\HttpFoundation\Response
    public function handle(Exception $exception);

Usage Example

示例#1
0
 /**
  * {@inheritdoc}
  */
 public function handle(Exception $exception)
 {
     if ($this->rethrow) {
         throw $exception;
     }
     foreach ($this->handlers as $index => $handler) {
         try {
             if (is_string($handler)) {
                 $handler = $this->resolver->resolve($handler);
                 $this->handlers->offsetSet($index, $handler);
             } else {
                 if (is_array($handler) && is_string($handler[0])) {
                     $handler[0] = $this->resolver->resolve($handler[0]);
                     $this->handlers->offsetSet($index, $handler);
                 }
             }
             if (!$this->matchesTypehint($handler, $exception)) {
                 continue;
             }
             $result = $this->callHandler($handler, $exception);
             if ($result !== null) {
                 return $this->makeResponse($result, $exception);
             }
         } catch (Exception $newException) {
             return $this->handle($newException);
         }
     }
     return $this->makeResponse($this->defaultHandler->handle($exception), $exception);
 }
All Usage Examples Of Autarky\Errors\ErrorHandlerInterface::handle
ErrorHandlerInterface