protected function handleException(\Throwable $e, Request $request) : Response
    {
        // Wrap non HTTP exception/errors
        if (!$e instanceof Exception\Exception) {
            $e = new Exception\UncaughtException($e);
        }
        
        // Throw to an appropriate handler
        $code = $e->getStatusCode();
        if ($this->exceptionHandlers[$code] instanceof ExceptionHandler) {
            return $this->exceptionHandlers[$code]->handle($e, $request);
        } elseif ($this->defaultExceptionHandler instanceof ExceptionHandler) {
            return $this->defaultExceptionHandler->handle($e, $request);
        } else {
            return (new \Circuit\ExceptionHandler\DefaultHandler)->handle($e, $request);
        }
    }
protected function handleException(\Throwable $e, Request $request) : Response
    {
        // Wrap non HTTP exception/errors
        if (!$e instanceof Exception\Exception) {
            $e = new Exception\UncaughtException($e);
        }
        
        // Throw to an appropriate handler
        $code = $e->getStatusCode();
        if ($this->exceptionHandlers[$code] instanceof ExceptionHandler) {
            return $this->exceptionHandlers[$code]->handle($e, $request);
        } elseif ($this->defaultExceptionHandler instanceof ExceptionHandler) {
            return $this->defaultExceptionHandler->handle($e, $request);
        } else {
            return (new \Circuit\ExceptionHandler\DefaultHandler)->handle($e, $request);
        }
    }
protected function handleException ( \ Throwable $ e , Request $ request ) : Response { // Wrap non HTTP exception/errors if ( ! $ e instanceof Exception \ Exception ) { $ e = new Exception \ UncaughtException ( $ e ) ; } // Throw to an appropriate handler $ code = $ e -> getStatusCode ( ) ; if ( $ this -> exceptionHandlers [ $ code ] instanceof ExceptionHandler ) { return $ this -> exceptionHandlers [ $ code ] -> handle ( $ e , $ request ) ; } elseif ( $ this -> defaultExceptionHandler instanceof ExceptionHandler ) { return $ this -> defaultExceptionHandler -> handle ( $ e , $ request ) ; } else { return ( new \ Circuit \ ExceptionHandler \ DefaultHandler ) -> handle ( $ e , $ request ) ; } }
Handle an exception during processing of route.

@param Throwable $e The Exception / Error thrown.
@param Request $request The request that caused the exception.
@return Response The response to the exception (e.g. error page)
Handle an exception during processing of route .