@@ -252,27 +252,17 @@ await Task.WhenAny(sendContentTask, readResponseTask).ConfigureAwait(false) == s
252252 {
253253 case Http3ErrorCode . VersionFallback :
254254 // The server is requesting us fall back to an older HTTP version.
255- throw new HttpRequestException ( SR . net_http_retry_on_older_version , ex , RequestRetryType . RetryOnLowerHttpVersion , httpRequestError : HttpRequestError . VersionNegotiationError ) ;
255+ throw new HttpRequestException ( SR . net_http_retry_on_older_version , ex , RequestRetryType . RetryOnLowerHttpVersion ) ;
256256
257257 case Http3ErrorCode . RequestRejected :
258258 // The server is rejecting the request without processing it, retry it on a different connection.
259- throw new HttpRequestException ( SR . net_http_request_aborted , ex , RequestRetryType . RetryOnConnectionFailure , httpRequestError : HttpRequestError . Unknown ) ;
259+ HttpProtocolException rejectedException = HttpProtocolException . CreateHttp3StreamException ( code , ex ) ;
260+ throw new HttpRequestException ( SR . net_http_request_aborted , rejectedException , RequestRetryType . RetryOnConnectionFailure , httpRequestError : HttpRequestError . HttpProtocolError ) ;
260261
261262 default :
262263 // Our stream was reset.
263- HttpRequestError httpRequestError ;
264- Exception innerException ;
265- if ( _connection . AbortException != null )
266- {
267- httpRequestError = HttpRequestError . Unknown ;
268- innerException = _connection . AbortException ;
269- }
270- else
271- {
272- httpRequestError = HttpRequestError . HttpProtocolError ;
273- innerException = HttpProtocolException . CreateHttp3StreamException ( code ) ;
274- }
275- throw new HttpRequestException ( SR . net_http_client_execution_error , innerException , httpRequestError : httpRequestError ) ;
264+ var innerException = HttpProtocolException . CreateHttp3StreamException ( code , ex ) ;
265+ throw new HttpRequestException ( SR . net_http_client_execution_error , innerException , httpRequestError : HttpRequestError . HttpProtocolError ) ;
276266 }
277267 }
278268 catch ( QuicException ex ) when ( ex . QuicError == QuicError . ConnectionAborted )
@@ -1265,7 +1255,7 @@ private void HandleReadResponseContentException(Exception ex, CancellationToken
12651255 case QuicException e when ( e . QuicError == QuicError . StreamAborted ) :
12661256 // Peer aborted the stream
12671257 Debug . Assert ( e . ApplicationErrorCode . HasValue ) ;
1268- throw HttpProtocolException . CreateHttp3StreamException ( ( Http3ErrorCode ) e . ApplicationErrorCode . Value ) ;
1258+ throw HttpProtocolException . CreateHttp3StreamException ( ( Http3ErrorCode ) e . ApplicationErrorCode . Value , e ) ;
12691259
12701260 case QuicException e when ( e . QuicError == QuicError . ConnectionAborted ) :
12711261 // Our connection was reset. Start aborting the connection.
0 commit comments