chatErrorMessages.ts ×17

Frontier kind: Code frontier

unlabeled · c_92bcd83af5d2

12 tests · 20742 LOC · 110 files · introduces 0 tests · 25 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
17 ranges25 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
2388 ranges20742 lines · 110 files · Browse complete extent
All tests (intent)
12 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: 25 introduced LOC across 17 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/workbench/contrib/chat/common/chatErrorMessages.ts 25 introduced LOC · 17 ranges

Open complete file

273 */
274 export function getChatErrorDetailsFromFetchError(fetchError: IChatFetchErrorPayload, copilotPlan: string | undefined, isUsageBasedBilling?: boolean, quotaResetDate?: string): IChatResponseErrorDetails {
275 > return { code: fetchError.type, ...getChatErrorDetailsInner(fetchError, copilotPlan, isUsageBasedBilling, quotaResetDate) }; chatErrorMessages.ts
276 > }
277
278 > function getChatErrorDetailsInner(fetchError: IChatFetchErrorPayload, copilotPlan: string | undefined, isUsageBasedBilling?: boolean, quotaResetDate?: string): IChatResponseErrorDetails { chatErrorMessages.ts
279 > const requestId = fetchError.requestId ?? '';
280 > const reason = fetchError.reason ?? '';
281 > switch (fetchError.type) {
282 > case ChatFetchResponseType.OffTopic:
283 return { message: localize('chatError.offTopic', "Sorry, but I can only assist with programming related questions.") };
284 > case ChatFetchResponseType.Canceled: chatErrorMessages.ts
285 return CanceledMessage;
286 > case ChatFetchResponseType.RateLimited: chatErrorMessages.ts
287 return {
288 message: getRateLimitMessage(fetchError, copilotPlan),
290 isRateLimited: true
291 };
292 > case ChatFetchResponseType.QuotaExceeded: chatErrorMessages.ts
293 return {
294 message: getQuotaHitMessage(fetchError, copilotPlan, isUsageBasedBilling, quotaResetDate),
296 ...(fetchError.capiError?.code && { code: fetchError.capiError.code }),
297 };
298 > case ChatFetchResponseType.BadRequest: chatErrorMessages.ts
299 > case ChatFetchResponseType.Failed:
300 return fetchError.serverRequestId
301 ? { message: localize('chatError.failedWithServerId', "Sorry, your request failed. Please try again.\n\nClient Request Id: {0}\n\nGH Request Id: {1}\n\nReason: {2}", requestId, fetchError.serverRequestId, reason) }
302 : { message: localize('chatError.failed', "Sorry, your request failed. Please try again.\n\nClient Request Id: {0}\n\nReason: {1}", requestId, reason) };
303 > case ChatFetchResponseType.NetworkError: chatErrorMessages.ts
304 return { message: localize('chatError.network', "Sorry, there was a network error. Please try again later. Request id: {0}\n\nReason: {1}", requestId, reason) };
305 > case ChatFetchResponseType.Filtered: chatErrorMessages.ts
306 > case ChatFetchResponseType.PromptFiltered:
307 return {
308 message: getFilteredMessage(fetchError.category ?? ''),
310 level: ChatErrorLevel.Info,
311 };
312 > case ChatFetchResponseType.AgentUnauthorized: chatErrorMessages.ts
313 return { message: localize('chatError.somethingWrong', "Sorry, something went wrong.") };
314 > case ChatFetchResponseType.AgentFailedDependency: chatErrorMessages.ts
315 return { message: reason };
316 > case ChatFetchResponseType.Length: chatErrorMessages.ts
317 return { message: localize('chatError.length', "Sorry, the response hit the length limit. Please rephrase your prompt.") };
318 > case ChatFetchResponseType.NotFound: chatErrorMessages.ts
319 return { message: localize('chatError.notFound', "Sorry, the resource was not found.") };
320 > case ChatFetchResponseType.Unknown: chatErrorMessages.ts
321 return { message: localize('chatError.unknown', "Sorry, no response was returned.") };
322 > case ChatFetchResponseType.ExtensionBlocked: chatErrorMessages.ts
323 return { message: localize('chatError.extensionBlocked', "Sorry, something went wrong.") };
324 > case ChatFetchResponseType.InvalidStatefulMarker: chatErrorMessages.ts
325 // should be unreachable, retried within the endpoint
326 return { message: localize('chatError.invalidStatefulMarker', "Your chat session state is invalid, please start a new chat.") };
327 > default: chatErrorMessages.ts
328 return { message: reason || localize('chatError.somethingWrong', "Sorry, something went wrong.") };
330 > }
331
332 /**