< Summary

Information
Class: IceRpc.Transports.Quic.Internal.QuicExceptionExtensions
Assembly: IceRpc.Transports.Quic
File(s): /home/runner/work/icerpc-csharp/icerpc-csharp/src/IceRpc.Transports.Quic/Internal/QuicExceptionExtensions.cs
Tag: 275_13775359185
Line coverage
92%
Covered lines: 35
Uncovered lines: 3
Coverable lines: 38
Total lines: 49
Line coverage: 92.1%
Branch coverage
57%
Covered branches: 15
Total branches: 26
Branch coverage: 57.6%
Method coverage
100%
Covered methods: 1
Total methods: 1
Method coverage: 100%

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
ToIceRpcException(...)57.69%26.332692.1%

File(s)

/home/runner/work/icerpc-csharp/icerpc-csharp/src/IceRpc.Transports.Quic/Internal/QuicExceptionExtensions.cs

#LineLine coverage
 1// Copyright (c) ZeroC, Inc.
 2
 3using System.Net.Quic;
 4
 5namespace IceRpc.Transports.Quic.Internal;
 6
 7internal static class QuicExceptionExtensions
 8{
 9    /// <summary>Converts a <see cref="QuicException"/> into an <see cref="IceRpcException"/>.</summary>
 10    internal static IceRpcException ToIceRpcException(this QuicException exception) =>
 7811        exception.QuicError switch
 7812        {
 7813            QuicError.ConnectionAborted =>
 6414                exception.ApplicationErrorCode is long applicationErrorCode ?
 6415                    applicationErrorCode switch
 6416                    {
 6417                        (long)MultiplexedConnectionCloseError.NoError =>
 1218                            new IceRpcException(IceRpcError.ConnectionClosedByPeer),
 6419                        (long)MultiplexedConnectionCloseError.Refused =>
 1020                            new IceRpcException(IceRpcError.ConnectionRefused),
 6421                        (long)MultiplexedConnectionCloseError.ServerBusy =>
 1222                            new IceRpcException(IceRpcError.ServerBusy),
 6423                        (long)MultiplexedConnectionCloseError.Aborted =>
 1824                            new IceRpcException(
 1825                                IceRpcError.ConnectionAborted,
 1826                                "The connection was aborted by the peer."),
 1227                        _ => new IceRpcException(
 1228                                IceRpcError.ConnectionAborted,
 1229                                $"The connection was aborted by the peer with an unknown application error code: '{appli
 6430                    } :
 6431                    // An application error code should always be set with QuicError.ConnectionAborted.
 6432                    new IceRpcException(IceRpcError.IceRpcError, exception),
 033            QuicError.ConnectionRefused => new IceRpcException(IceRpcError.ConnectionRefused, exception),
 034            QuicError.ConnectionTimeout => new IceRpcException(IceRpcError.ConnectionAborted, exception),
 535            QuicError.ConnectionIdle => new IceRpcException(IceRpcError.ConnectionIdle, exception),
 536            QuicError.OperationAborted => new IceRpcException(IceRpcError.OperationAborted, exception),
 237            QuicError.AlpnInUse => new IceRpcException(IceRpcError.AddressInUse, exception),
 7838            QuicError.StreamAborted =>
 239                exception.ApplicationErrorCode is long applicationErrorCode ?
 240                    applicationErrorCode == 0 ?
 241                        new IceRpcException(IceRpcError.TruncatedData, exception) :
 242                        new IceRpcException(
 243                            IceRpcError.TruncatedData,
 244                            $"The stream was aborted by the peer with an unknown application error code: '{applicationEr
 245                    // An application error code should always be set with QuicError.StreamAborted.
 246                    new IceRpcException(IceRpcError.IceRpcError, exception),
 047            _ => new IceRpcException(IceRpcError.IceRpcError, exception)
 7848        };
 49}