< Summary

Information
Class: NexusLabs.Needlr.Copilot.CopilotAuthException
Assembly: NexusLabs.Needlr.Copilot
File(s): /home/runner/work/needlr/needlr/src/NexusLabs.Needlr.Copilot/CopilotAuthException.cs
Line coverage
50%
Covered lines: 2
Uncovered lines: 2
Coverable lines: 4
Total lines: 50
Line coverage: 50%
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
.ctor(...)100%11100%
.ctor(...)100%210%

File(s)

/home/runner/work/needlr/needlr/src/NexusLabs.Needlr.Copilot/CopilotAuthException.cs

#LineLine coverage
 1namespace NexusLabs.Needlr.Copilot;
 2
 3/// <summary>
 4/// Thrown when a Copilot request fails because the caller is not
 5/// authenticated. This covers two distinct cases:
 6/// </summary>
 7/// <remarks>
 8/// <para>
 9/// 1. <b>No token configured locally.</b>
 10/// <see cref="GitHubOAuthTokenProvider"/> could not resolve a GitHub OAuth
 11/// token from any configured source (explicit option, apps.json, or
 12/// environment variables). The HTTP request is never sent.
 13/// </para>
 14/// <para>
 15/// 2. <b>Token rejected by the server.</b>
 16/// <see cref="CopilotMcpToolClient"/> received an HTTP <c>401 Unauthorized</c>
 17/// or <c>403 Forbidden</c> response from the Copilot MCP endpoint, indicating
 18/// the supplied token is invalid, expired, or lacks the required scopes.
 19/// </para>
 20/// <para>
 21/// Callers should catch this exception to implement fallback behavior such
 22/// as switching to an alternative search provider or surfacing a
 23/// re-authentication prompt to the user. This is the auth analog of
 24/// <see cref="CopilotRateLimitException"/> and exists so consumers do not
 25/// have to string-match free-text error messages from the upstream server.
 26/// </para>
 27/// </remarks>
 28public sealed class CopilotAuthException : Exception
 29{
 30    /// <summary>
 31    /// Creates a new <see cref="CopilotAuthException"/> with the given
 32    /// human-readable message.
 33    /// </summary>
 34    /// <param name="message">A description of the auth failure.</param>
 35    public CopilotAuthException(string message)
 536        : base(message)
 37    {
 538    }
 39
 40    /// <summary>
 41    /// Creates a new <see cref="CopilotAuthException"/> wrapping the given
 42    /// inner exception.
 43    /// </summary>
 44    /// <param name="message">A description of the auth failure.</param>
 45    /// <param name="innerException">The underlying exception that caused this failure.</param>
 46    public CopilotAuthException(string message, Exception innerException)
 047        : base(message, innerException)
 48    {
 049    }
 50}