< Summary

Information
Class: NexusLabs.Needlr.AgentFramework.Providers.ProviderUnavailableException
Assembly: NexusLabs.Needlr.AgentFramework
File(s): /home/runner/work/needlr/needlr/src/NexusLabs.Needlr.AgentFramework/Providers/ITieredProvider.cs
Line coverage
75%
Covered lines: 3
Uncovered lines: 1
Coverable lines: 4
Total lines: 46
Line coverage: 75%
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_ProviderName()100%210%
.ctor(...)100%11100%

File(s)

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

#LineLine coverage
 1namespace NexusLabs.Needlr.AgentFramework.Providers;
 2
 3/// <summary>
 4/// A provider in a priority-ordered fallback chain. Providers are tried in order of
 5/// ascending <see cref="Priority"/> until one succeeds or all fail.
 6/// </summary>
 7/// <typeparam name="TQuery">The query/request type.</typeparam>
 8/// <typeparam name="TResult">The result type.</typeparam>
 9public interface ITieredProvider<in TQuery, TResult>
 10{
 11    /// <summary>Gets the provider's display name (used in diagnostics and logging).</summary>
 12    string Name { get; }
 13
 14    /// <summary>
 15    /// Gets the priority for ordering. Lower values = higher priority (tried first).
 16    /// </summary>
 17    int Priority { get; }
 18
 19    /// <summary>Gets whether this provider is enabled and should participate in the chain.</summary>
 20    bool IsEnabled { get; }
 21
 22    /// <summary>Executes the query against this provider.</summary>
 23    /// <exception cref="ProviderUnavailableException">
 24    /// The provider is temporarily unavailable. The selector will try the next provider.
 25    /// </exception>
 26    Task<TResult> ExecuteAsync(TQuery query, CancellationToken cancellationToken);
 27}
 28
 29/// <summary>
 30/// Thrown when a provider is temporarily unavailable. The tiered selector catches this
 31/// and falls through to the next provider in the chain.
 32/// </summary>
 33public class ProviderUnavailableException : Exception
 34{
 35    /// <summary>Gets the name of the provider that was unavailable.</summary>
 036    public string ProviderName { get; }
 37
 38    /// <param name="providerName">The provider that was unavailable.</param>
 39    /// <param name="message">A description of why the provider is unavailable.</param>
 40    /// <param name="innerException">The original exception, if any.</param>
 41    public ProviderUnavailableException(string providerName, string message, Exception? innerException = null)
 442        : base(message, innerException)
 43    {
 444        ProviderName = providerName;
 445    }
 46}