@@ -102,8 +102,8 @@ public function __destruct()
102102 * @throws \Http\Client\Exception\RequestException On invalid request.
103103 * @throws \InvalidArgumentException For invalid header names or values.
104104 * @throws \RuntimeException If creating the body stream fails.
105- * @throws \UnexpectedValueException if unsupported HTTP version requested
106105 *
106+ * @since x.x \UnexpectedValueException replaced with RequestException.
107107 * @since x.x Throw NetworkException on network errors.
108108 * @since 1.0
109109 */
@@ -149,11 +149,11 @@ public function sendRequest(RequestInterface $request)
149149 *
150150 * @return Promise
151151 *
152+ * @throws \Http\Client\Exception\RequestException On invalid request.
152153 * @throws \InvalidArgumentException For invalid header names or values.
153- * @throws \RuntimeException If creating the body stream fails.
154- * @throws \UnexpectedValueException If unsupported HTTP version requested
155- * @throws Exception
154+ * @throws \RuntimeException If creating the body stream fails.
156155 *
156+ * @since x.x \UnexpectedValueException replaced with RequestException.
157157 * @since 1.0
158158 */
159159 public function sendAsyncRequest (RequestInterface $ request )
@@ -180,9 +180,9 @@ public function sendAsyncRequest(RequestInterface $request)
180180 * @param RequestInterface $request
181181 * @param ResponseBuilder $responseBuilder
182182 *
183+ * @throws \Http\Client\Exception\RequestException On invalid request.
183184 * @throws \InvalidArgumentException For invalid header names or values.
184185 * @throws \RuntimeException if can not read body
185- * @throws \UnexpectedValueException if unsupported HTTP version requested
186186 *
187187 * @return array
188188 */
@@ -194,7 +194,12 @@ private function createCurlOptions(RequestInterface $request, ResponseBuilder $r
194194 $ options [CURLOPT_RETURNTRANSFER ] = false ;
195195 $ options [CURLOPT_FOLLOWLOCATION ] = false ;
196196
197- $ options [CURLOPT_HTTP_VERSION ] = $ this ->getProtocolVersion ($ request ->getProtocolVersion ());
197+ try {
198+ $ options [CURLOPT_HTTP_VERSION ]
199+ = $ this ->getProtocolVersion ($ request ->getProtocolVersion ());
200+ } catch (\UnexpectedValueException $ e ) {
201+ throw new Exception \RequestException ($ e ->getMessage (), $ request );
202+ }
198203 $ options [CURLOPT_URL ] = (string ) $ request ->getUri ();
199204
200205 /*
0 commit comments