-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[API Proposal]: [QUIC] QuicException #70669
Labels
api-approved
API was approved in API review, it can be implemented
area-System.Net.Quic
blocking
Marks issues that we want to fast track in order to unblock other important work
Milestone
Comments
Tagging subscribers to this area: @dotnet/ncl Issue DetailsTODO
|
This was referenced Jun 14, 2022
namespace System.Net.Quic;
public sealed class QuicException : IOException
{
public QuicException(QuicError error, string message, long? applicationErrorCode, Exception? innerException);
public QuicError QuicError { get; }
public long? ApplicationErrorCode { get; }
}
public enum QuicError
{
Success,
InternalError,
ConnectionAborted,
StreamAborted,
AddressInUse,
InvalidAddress,
ConnectionTimeout,
HostUnreachable,
ConnectionRefused,
VersionNegotiationError,
ConnectionIdle,
ProtocolError,
OperationAborted,
} |
Note: Another change in the final approved API against the original proposal is nullable |
should this be QuicError? |
rzikm
added a commit
to rzikm/dotnet-runtime
that referenced
this issue
Jul 12, 2022
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
api-approved
API was approved in API review, it can be implemented
area-System.Net.Quic
blocking
Marks issues that we want to fast track in order to unblock other important work
This proposal is for exceptions thrown from the new System.Net.Quic APIs covered in following proposals.
Proposed design
In general, we reuse the same types of exceptions used for the same concept in other areas:
AuthenticationException
for handshake-related errors like inSslStream
InvalidOperationException
for overlapping async read/write operationsObjectDisposedException
,OperationCanceledException
, ...For the errors which are specific to QUIC, we add a new exception type:
QuicException
inspired bySocket
s SocketException with SocketError.Usage examples
Kestrel (accepting incoming requests)
Kestrel (reading requests)
Http3RequestStream.SendAsync
Note that the usage may be modified based on the outcome of #70684.
Comparison with other APIs
Sockets
As already mentioned, the exception throwing is inspired by that of
Socket
class, which usesSocketException for all socket-related errors with SocketError giving more specific details (reason).
SslStream
SslStream
by itself does not generate any low-level transport exceptions, it just propagates whichever exceptions are thrown by the inner stream (e.g.IOException
with innerSocketException
fromNetworkStream
). This is not possible for QUIC as it does not wrap any other abstraction.SslStream
by itself generates following:AuthenticationException
QuicConnection
for consistencyInvalidOperationException
- for overlapping read/write operationsQuicStream
for consistency.Alternative designs
Subclasses with non-nullable Application level error code
This removes the need to handle nullability warnings when accessing the
ApplicationProtocolErrorCode
when we know (based on the knowledge of the protocol) that it needs to be not-null.ErrorCode in QuicException subclasses
Summary of expected exceptions from QUIC API
Below are the API classes annotated with expected exceptions (to be included in the documentation).
QuicListener
QuicConnection
QuicStream
The text was updated successfully, but these errors were encountered: