< Summary

Class:Azure.Messaging.EventHubs.Core.ExceptionExtensions
Assembly:Azure.Messaging.EventHubs
File(s):C:\Git\azure-sdk-for-net\sdk\eventhub\Azure.Messaging.EventHubs\src\Core\ExceptionExtensions.cs
Covered lines:5
Uncovered lines:0
Coverable lines:5
Total lines:45
Line coverage:100% (5 of 5)
Covered branches:3
Total branches:6
Branch coverage:50% (3 of 6)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
IsNotType(...)-100%100%
IsFatalException(...)-100%50%

File(s)

C:\Git\azure-sdk-for-net\sdk\eventhub\Azure.Messaging.EventHubs\src\Core\ExceptionExtensions.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4using System;
 5using System.Threading;
 6using System.Threading.Tasks;
 7
 8namespace Azure.Messaging.EventHubs.Core
 9{
 10    /// <summary>
 11    ///   The set of extensions for the <see cref="Exception" />
 12    ///   class.
 13    /// </summary>
 14    ///
 15    internal static class ExceptionExtensions
 16    {
 17        /// <summary>
 18        ///   Serves as an inverse to the "is" operator, determining whether the <paramref name="instance"/>
 19        ///   is NOT of type <typeparamref name="T"/>.
 20        /// </summary>
 21        ///
 22        /// <typeparam name="T">The <see cref="Exception" /> type to test the <paramref name="instance"/> against.</type
 23        ///
 24        /// <param name="instance">The instance to consider.</param>
 25        ///
 26        /// <returns><c>true</c> if the specified instance is NOT of type <typeparamref name="T"/>; otherwise, <c>false<
 27        ///
 5828        public static bool IsNotType<T>(this Exception instance) where T : Exception => (!(instance is T));
 29
 30        /// <summary>
 31        ///   Determines whether the <paramref name="instance"/> is a well-known fatal exception and should avoid retrie
 32        ///   logging, and similar activities.
 33        /// </summary>
 34        ///
 35        /// <param name="instance">The instance to consider.</param>
 36        ///
 37        /// <returns><c>true</c> if the specified instance should be considered fatal; otherwise, <c>false</c>.</returns
 38        ///
 39        public static bool IsFatalException(this Exception instance) =>
 10640            (instance is TaskCanceledException
 10641                || instance is OutOfMemoryException
 10642                || instance is StackOverflowException
 10643                || instance is ThreadAbortException);
 44    }
 45}