< Summary - CoreWCF Coverage — PR #1766

Information
Class: CoreWCF.ServiceModel.Channels.KafkaChannelHelpers
Assembly: CoreWCF.Kafka.Client
File(s): /home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Kafka.Client/src/CoreWCF/ServiceModel/Channels/Helpers/KafkaChannelHelpers.cs
Line coverage
33%
Covered lines: 2
Uncovered lines: 4
Coverable lines: 6
Total lines: 25
Line coverage: 33.3%
Branch coverage
50%
Covered branches: 2
Total branches: 4
Branch coverage: 50%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity NPath complexity Sequence coverage
ConvertKafkaException(...)50%4433.33%

File(s)

/home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Kafka.Client/src/CoreWCF/ServiceModel/Channels/Helpers/KafkaChannelHelpers.cs

#LineLine coverage
 1// Licensed to the .NET Foundation under one or more agreements.
 2// The .NET Foundation licenses this file to you under the MIT license.
 3
 4using System;
 5using System.Globalization;
 6using System.ServiceModel;
 7using Confluent.Kafka;
 8
 9namespace CoreWCF.ServiceModel.Channels;
 10
 11internal static class KafkaChannelHelpers
 12{
 13    public static Exception ConvertKafkaException(KafkaException kafkaException)
 14    {
 115        if (kafkaException.Error.IsLocalError && kafkaException.Error.Code == ErrorCode.Local_MsgTimedOut)
 16        {
 117            throw new TimeoutException(SR.KafkaSendTimeout, kafkaException);
 18        }
 19
 020        return new CommunicationException(
 021            string.Format(CultureInfo.CurrentCulture,
 022                "An error ({0}: {1}) occurred while transmitting data.", kafkaException.Error.Code, kafkaException.Error
 023            kafkaException);
 24    }
 25}