@@ -102,8 +102,8 @@ public function __destruct()
102
102
* @throws \Http\Client\Exception\RequestException On invalid request.
103
103
* @throws \InvalidArgumentException For invalid header names or values.
104
104
* @throws \RuntimeException If creating the body stream fails.
105
- * @throws \UnexpectedValueException if unsupported HTTP version requested
106
105
*
106
+ * @since x.x \UnexpectedValueException replaced with RequestException.
107
107
* @since x.x Throw NetworkException on network errors.
108
108
* @since 1.0
109
109
*/
@@ -149,11 +149,11 @@ public function sendRequest(RequestInterface $request)
149
149
*
150
150
* @return Promise
151
151
*
152
+ * @throws \Http\Client\Exception\RequestException On invalid request.
152
153
* @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.
156
155
*
156
+ * @since x.x \UnexpectedValueException replaced with RequestException.
157
157
* @since 1.0
158
158
*/
159
159
public function sendAsyncRequest (RequestInterface $ request )
@@ -180,9 +180,9 @@ public function sendAsyncRequest(RequestInterface $request)
180
180
* @param RequestInterface $request
181
181
* @param ResponseBuilder $responseBuilder
182
182
*
183
+ * @throws \Http\Client\Exception\RequestException On invalid request.
183
184
* @throws \InvalidArgumentException For invalid header names or values.
184
185
* @throws \RuntimeException if can not read body
185
- * @throws \UnexpectedValueException if unsupported HTTP version requested
186
186
*
187
187
* @return array
188
188
*/
@@ -194,7 +194,12 @@ private function createCurlOptions(RequestInterface $request, ResponseBuilder $r
194
194
$ options [CURLOPT_RETURNTRANSFER ] = false ;
195
195
$ options [CURLOPT_FOLLOWLOCATION ] = false ;
196
196
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
+ }
198
203
$ options [CURLOPT_URL ] = (string ) $ request ->getUri ();
199
204
200
205
/*
0 commit comments