/**
  * Dispatch http-interop middleware
  *
  * @param ServerMiddlewareInterface $middleware
  * @param callable $next
  * @param RequestInterface $request
  * @return ResponseInterface
  * @throws Exception\MissingResponsePrototypeException if no response
  *     prototype is available with which to call the delegate.
  * @throws Exception\InvalidRequestTypeException if the request provided
  *     is not a server-side request.
  */
 private function dispatchInteropMiddleware(ServerMiddlewareInterface $middleware, callable $next, RequestInterface $request)
 {
     if ($middleware instanceof MiddlewarePipe && !$middleware->hasResponsePrototype() && $this->responsePrototype) {
         $middleware->setResponsePrototype($this->responsePrototype);
     }
     if ($this->raiseThrowables) {
         return $middleware->process($request, $next);
     }
     try {
         return $middleware->process($request, $next);
     } catch (Throwable $throwable) {
         return $this->handleThrowableFromInteropMiddleware($throwable, $request, $next);
     } catch (\Exception $exception) {
         return $this->handleThrowableFromInteropMiddleware($exception, $request, $next);
     }
 }
 /**
  * {@inheritdoc}
  */
 public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = true)
 {
     $psr7Request = $this->httpMessageFactory->createRequest($request);
     $psr7Response = $this->psrMiddleware->process($psr7Request, $this);
     return $this->httpFoundationFactory->createResponse($psr7Response);
 }