chatErrorMessages.ts ×8

Frontier kind: Code frontier

unlabeled · c_f53d70f63342

3 tests · 20757 LOC · 110 files · introduces 0 tests · 15 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
8 ranges15 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
2396 ranges20757 lines · 110 files · Browse complete extent
All tests (intent)
3 testsBrowse complete intent

Neighbourhood graph

The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.

Introduced files, introduced tests, and structurally relevant concept specialization

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the native relationship evidence on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

No tests are introduced at this concept. Its intent tests are introduced by other concepts.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

1 file ranked by introduced lines: 15 introduced LOC across 8 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/workbench/contrib/chat/common/chatErrorMessages.ts 15 introduced LOC · 8 ranges

Open complete file

116 }
117
118 > function getRateLimitMessage(fetchError: IChatFetchErrorPayload, copilotPlan: string | undefined): string { chatErrorMessages.ts
119 > const retryAfterString = fetchError.retryAfter ? secondsToHumanReadableTime(fetchError.retryAfter) : localize('chatError.aMoment', "a moment");
120 > const code = fetchError.capiError?.code;
121 > if (code?.startsWith('agent_mode_limit_exceeded')) { // Rate limited in agent mode
122 return localize({ key: 'chatError.rateLimit.agentMode', comment: [`{Locked=']({'}`] }, "Sorry, you have exceeded the agent mode rate limit. Please switch to ask mode and try again in {0}. [Learn More]({1})", retryAfterString, RATE_LIMIT_LEARN_MORE_URL);
123 }
124 > if (code?.startsWith('model_overloaded') || code?.startsWith('upstream_provider_rate_limit')) { chatErrorMessages.ts
125 if (fetchError.isAuto) {
126 return localize({ key: 'chatError.rateLimit.overloadedAuto', comment: [`{Locked=']({'}`] }, "Sorry, the upstream model provider is currently experiencing high demand. Please try again in {0}. [Learn More]({1})", retryAfterString, RATE_LIMIT_LEARN_MORE_URL);
128 return localize({ key: 'chatError.rateLimit.overloaded', comment: [`{Locked=']({'}`] }, "Sorry, the upstream model provider is currently experiencing high demand. Please try again in {0} or consider switching to Auto. [Learn More]({1})", retryAfterString, RATE_LIMIT_LEARN_MORE_URL);
129 }
130 > if (code?.startsWith('user_global_rate_limited')) { chatErrorMessages.ts
131 if (copilotPlan === 'free' || copilotPlan === 'individual' || copilotPlan === 'individual_pro' || copilotPlan === 'edu') {
132 return localize({ key: 'chatError.rateLimit.sessionUpgrade', comment: [`{Locked=']({'}`] }, "You've hit your session rate limit. Please upgrade your plan or wait {0} for your limit to reset. [Learn More]({1})", retryAfterString, RATE_LIMIT_LEARN_MORE_URL);
134 return localize({ key: 'chatError.rateLimit.session', comment: [`{Locked=']({'}`] }, "You've hit your session rate limit. Please wait {0} for your limit to reset. [Learn More]({1})", retryAfterString, RATE_LIMIT_LEARN_MORE_URL);
135 }
136 > if (code?.startsWith('user_weekly_rate_limited')) { chatErrorMessages.ts
137 if (fetchError.retryAfter) {
138 const resetDate = new Date(Date.now() + fetchError.retryAfter * 1000);
148 return localize({ key: 'chatError.rateLimit.weekly', comment: [`{Locked=']({'}`] }, "You've reached your weekly rate limit. Please switch to the Auto model to continue working or wait {0} for your limit to reset. [Learn More]({1})", retryAfterString, RATE_LIMIT_LEARN_MORE_URL);
149 }
150 > if (code?.startsWith('user_model_rate_limited')) { chatErrorMessages.ts
151 if (fetchError.isAuto) {
152 return localize({ key: 'chatError.rateLimit.modelAuto', comment: [`{Locked=']({'}`] }, "You've hit the rate limit for this model. Please try again in {0}. [Learn More]({1})", retryAfterString, RATE_LIMIT_LEARN_MORE_URL);
154 return localize({ key: 'chatError.rateLimit.model', comment: [`{Locked=']({'}`] }, "You've hit the rate limit for this model. Please try switching to Auto or try again in {0}. [Learn More]({1})", retryAfterString, RATE_LIMIT_LEARN_MORE_URL);
155 }
156 > if (code?.startsWith('integration_rate_limited')) { chatErrorMessages.ts
157 return localize({ key: 'chatError.rateLimit.integration', comment: [`{Locked=']({'}`] }, "Sorry, GitHub Copilot Chat is currently experiencing high demand. Please try again in {0}. [Learn More]({1})", retryAfterString, RATE_LIMIT_LEARN_MORE_URL);
158 }
159
160 > if (fetchError.capiError?.code && fetchError.capiError?.message) { chatErrorMessages.ts
161 if (fetchError.isAuto) {
162 return localize({ key: 'chatError.rateLimit.serverAuto', comment: [`{Locked=']({'}`] }, "Sorry, you have been rate-limited. Please wait {0} before trying again. [Learn More]({1})\n\nServer Error: {2}\nError Code: {3}", retryAfterString, RATE_LIMIT_LEARN_MORE_URL, fetchError.capiError.message, fetchError.capiError.code);
285 return CanceledMessage;
286 case ChatFetchResponseType.RateLimited:
287 > return { chatErrorMessages.ts
288 > message: getRateLimitMessage(fetchError, copilotPlan),
289 > level: ChatErrorLevel.Info,
290 > isRateLimited: true
291 > };
292 case ChatFetchResponseType.QuotaExceeded:
293 return {