< Summary

Information
Class: NexusLabs.Needlr.AgentFramework.Providers.AllProvidersFailedException
Assembly: NexusLabs.Needlr.AgentFramework
File(s): /home/runner/work/needlr/needlr/src/NexusLabs.Needlr.AgentFramework/Providers/AllProvidersFailedException.cs
Line coverage
100%
Covered lines: 11
Uncovered lines: 0
Coverable lines: 11
Total lines: 46
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_Attempts()100%11100%
.ctor(...)100%11100%
.ctor(...)100%11100%
BuildMessage(...)100%11100%

File(s)

/home/runner/work/needlr/needlr/src/NexusLabs.Needlr.AgentFramework/Providers/AllProvidersFailedException.cs

#LineLine coverage
 1namespace NexusLabs.Needlr.AgentFramework.Providers;
 2
 3/// <summary>
 4/// Thrown by <see cref="ITieredProviderSelector{TQuery, TResult}"/> when at least one
 5/// provider was registered but every provider failed or was denied by the quota gate.
 6/// </summary>
 7/// <remarks>
 8/// Inherits from <see cref="NoProvidersAvailableException"/> so callers can choose to
 9/// catch the base type for both "no providers registered" and "all providers failed"
 10/// conditions, or catch this type specifically.
 11/// </remarks>
 12public sealed class AllProvidersFailedException : NoProvidersAvailableException
 13{
 14    /// <summary>
 15    /// Gets the per-provider attempt diagnostics in the order they were tried.
 16    /// Each entry describes one provider's outcome (e.g., quota denial or unavailability reason).
 17    /// </summary>
 1018    public IReadOnlyList<string> Attempts { get; }
 19
 20    /// <param name="attempts">
 21    /// Per-provider attempt diagnostics in the order providers were tried.
 22    /// </param>
 23    public AllProvidersFailedException(IReadOnlyList<string> attempts)
 924        : base(BuildMessage(attempts))
 25    {
 826        ArgumentNullException.ThrowIfNull(attempts);
 827        Attempts = attempts;
 828    }
 29
 30    /// <param name="attempts">
 31    /// Per-provider attempt diagnostics in the order providers were tried.
 32    /// </param>
 33    /// <param name="innerException">The underlying exception that caused this failure, if any.</param>
 34    public AllProvidersFailedException(IReadOnlyList<string> attempts, Exception? innerException)
 135        : base(BuildMessage(attempts), innerException)
 36    {
 137        ArgumentNullException.ThrowIfNull(attempts);
 138        Attempts = attempts;
 139    }
 40
 41    private static string BuildMessage(IReadOnlyList<string> attempts)
 42    {
 1043        ArgumentNullException.ThrowIfNull(attempts);
 944        return $"All providers failed. Attempts: [{string.Join("; ", attempts)}]";
 45    }
 46}