Skip to content

CopilotRateLimitException

NexusLabs.Needlr.Copilot

CopilotRateLimitException Class

Thrown when a Copilot web search request is rejected due to rate limiting. This can occur either via an HTTP 429 response after retry exhaustion or when the MCP tool returns a rate-limit error message as its content.

public sealed class CopilotRateLimitException : System.Exception

Inheritance System.Object 🡒 System.Exception 🡒 CopilotRateLimitException

Remarks

Callers should catch this exception to implement fallback behavior (e.g., trying an alternative search provider or waiting before retrying). RetryAfter provides a hint for how long to wait, when available from the response.

Constructors

CopilotRateLimitException(string, Nullable<TimeSpan>, Exception) Constructor

Creates a new CopilotRateLimitException with the given message, optional retry delay, and optional inner exception.

public CopilotRateLimitException(string message, System.Nullable<System.TimeSpan> retryAfter=null, System.Exception? innerException=null);

Parameters

message System.String

A description of the rate-limit condition.

retryAfter System.Nullable<System.TimeSpan>

How long the caller should wait before retrying, if known from the HTTP Retry-After header or the error message text.

innerException System.Exception

The exception that caused this failure, if any.

Properties

CopilotRateLimitException.RetryAfter Property

The suggested wait duration before retrying, parsed from the HTTP Retry-After header or the error message text. null when no retry hint was provided.

public System.Nullable<System.TimeSpan> RetryAfter { get; }

Property Value

System.Nullable<System.TimeSpan>