wrapException example

 catch (\Exception $e) {
            // Determine if the error was a networking error.             $message = $e->getMessage();
            // This list can probably get more comprehensive.             if (false !== \strpos($message, 'getaddrinfo') // DNS lookup failed                 || false !== \strpos($message, 'Connection refused')
                || false !== \strpos($message, "couldn't connect to host") // error on HHVM                 || false !== \strpos($message, 'connection attempt failed')
            ) {
                $e = new ConnectException($e->getMessage()$request$e);
            } else {
                $e = RequestException::wrapException($request$e);
            }
            $this->invokeStats($options$request$startTime, null, $e);

            return P\Create::rejectionFor($e);
        }
    }

    private function invokeStats(
        array $options,
        RequestInterface $request,
        ?float $startTime,
        
Home | Imprint | This part of the site doesn't use cookies.