-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dc6f9b4
commit 04bb7e5
Showing
27 changed files
with
440 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
src/libraries/System.Net.Http/src/System/Net/Http/HttpIOException.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System.IO; | ||
|
||
namespace System.Net.Http | ||
{ | ||
/// <summary> | ||
/// An exception thrown when an error occurs while reading the response. | ||
/// </summary> | ||
public class HttpIOException : IOException | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of the <see cref="HttpIOException"/> class. | ||
/// </summary> | ||
/// <param name="httpRequestError">The <see cref="Http.HttpRequestError"/> that caused the exception.</param> | ||
/// <param name="message">The message string describing the error.</param> | ||
/// <param name="innerException">The exception that is the cause of the current exception.</param> | ||
public HttpIOException(HttpRequestError httpRequestError, string? message = null, Exception? innerException = null) | ||
: base(message, innerException) | ||
{ | ||
HttpRequestError = httpRequestError; | ||
} | ||
|
||
/// <summary> | ||
/// Gets the <see cref="Http.HttpRequestError"/> that caused the exception. | ||
/// </summary> | ||
public HttpRequestError HttpRequestError { get; } | ||
|
||
/// <inheritdoc /> | ||
public override string Message => $"{base.Message} ({HttpRequestError})"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
src/libraries/System.Net.Http/src/System/Net/Http/HttpRequestError.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
namespace System.Net.Http | ||
{ | ||
/// <summary> | ||
/// Defines error categories representing the reason for <see cref="HttpRequestException"/> or <see cref="HttpIOException"/>. | ||
/// </summary> | ||
public enum HttpRequestError | ||
{ | ||
/// <summary> | ||
/// A generic or unknown error occurred. | ||
/// </summary> | ||
Unknown = 0, | ||
|
||
/// <summary> | ||
/// The DNS name resolution failed. | ||
/// </summary> | ||
NameResolutionError, | ||
|
||
/// <summary> | ||
/// A transport-level failure occurred while connecting to the remote endpoint. | ||
/// </summary> | ||
ConnectionError, | ||
|
||
/// <summary> | ||
/// An error occurred during the TLS handshake. | ||
/// </summary> | ||
SecureConnectionError, | ||
|
||
/// <summary> | ||
/// An HTTP/2 or HTTP/3 protocol error occurred. | ||
/// </summary> | ||
HttpProtocolError, | ||
|
||
/// <summary> | ||
/// Extended CONNECT for WebSockets over HTTP/2 is not supported by the peer. | ||
/// </summary> | ||
ExtendedConnectNotSupported, | ||
|
||
/// <summary> | ||
/// Cannot negotiate the HTTP Version requested. | ||
/// </summary> | ||
VersionNegotiationError, | ||
|
||
/// <summary> | ||
/// The authentication failed. | ||
/// </summary> | ||
UserAuthenticationError, | ||
|
||
/// <summary> | ||
/// An error occurred while establishing a connection to the proxy tunnel. | ||
/// </summary> | ||
ProxyTunnelError, | ||
|
||
/// <summary> | ||
/// An invalid or malformed response has been received. | ||
/// </summary> | ||
InvalidResponse, | ||
|
||
/// <summary> | ||
/// The response ended prematurely. | ||
/// </summary> | ||
ResponseEnded, | ||
|
||
/// <summary> | ||
/// The response exceeded a pre-configured limit such as <see cref="HttpClient.MaxResponseContentBufferSize"/> or <see cref="HttpClientHandler.MaxResponseHeadersLength"/>. | ||
/// </summary> | ||
ConfigurationLimitExceeded, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.