Ejemplo n.º 1
0
 public static string GetDescription(this QuicheErrorCode errorCode)
 {
     return(errorCode switch
     {
         QuicheErrorCode.Done => "There is no more work to do.",
         QuicheErrorCode.BufferTooShort => "The provided buffer is too short.",
         QuicheErrorCode.UnknownVersion => "The provided packet cannot be parsed because its version is unknown.",
         QuicheErrorCode.InvalidFrame => "The provided packet cannot be parsed because it contains an invalid frame.",
         QuicheErrorCode.InvalidPacket => "The provided packet cannot be parsed.",
         QuicheErrorCode.InvalidState => "The operation cannot be completed because the connection is in an invalid state.",
         QuicheErrorCode.InvalidStreamState => "The operation cannot be completed because the stream is in an invalid state.",
         QuicheErrorCode.InvalidTransportParam => "The peer's transport params cannot be parsed.",
         QuicheErrorCode.CryptoFail => "A cryptographic operation failed.",
         QuicheErrorCode.TlsFail => "The TLS handshake failed.",
         QuicheErrorCode.FlowControl => "The peer violated the local flow control limits.",
         QuicheErrorCode.StreamLimit => "The peer violated the local stream limits.",
         QuicheErrorCode.FinalSize => "The received data exceeds the stream's final size.",
         _ => $"Unknown Error (Error Code: {errorCode})"
     });
Ejemplo n.º 2
0
 private QuicheException(QuicheErrorCode errorCode, string message)
     : base(message)
 {
     ErrorCode = errorCode;
 }
Ejemplo n.º 3
0
 public static QuicheException FromErrorCode(QuicheErrorCode errorCode)
 {
     return(new QuicheException(errorCode, errorCode.GetDescription()));
 }