forwardedChatError.ts ×6

Frontier kind: Code frontier

unlabeled · c_2f7e046ce451

13 tests · 20104 LOC · 83 files · introduces 0 tests · 29 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
6 ranges29 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
1579 ranges20104 lines · 83 files · Browse complete extent
All tests (intent)
13 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: 29 introduced LOC across 6 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/platform/agentHost/node/shared/forwardedChatError.ts 29 introduced LOC · 6 ranges

Open complete file

94 */
95 export function buildForwardedChatError(err: CopilotApiError): IForwardedChatError {
96 > const status = err.status === COPILOT_API_ERROR_STATUS_STREAMING ? 502 : err.status; forwardedChatError.ts
97 > const requestId = typeof err.envelope.request_id === 'string' ? err.envelope.request_id : '';
98 > // CAPI rate-limit/quota errors carry their fine-grained code in the
99 > // response body (e.g. `{ "error": { "code": "quota_exceeded", ... } }`).
100 > // The proxy synthesizes a non-conforming body into the Anthropic envelope
101 > // as `error.type: 'api_error'` with the raw body as the message, so prefer
102 > // a CAPI code/message parsed out of the message when present.
103 > const capiError = extractCapiError(err.envelope.error.message) ?? { code: err.envelope.error.type, message: err.envelope.error.message };
104 > return {
105 > fetchError: {
106 > type: statusToFetchType(status),
107 > reason: capiError.message ?? err.envelope.error.message,
108 > requestId,
109 > capiError,
110 > },
111 > };
112 > }
113
114 /**
117 * not such a JSON payload.
118 */
119 > function extractCapiError(message: string): { code?: string; message?: string } | undefined { forwardedChatError.ts
120 > let parsed: unknown;
121 > try {
122 > parsed = JSON.parse(message);
123 > } catch {
124 return undefined;
125 }
126 > if (!parsed || typeof parsed !== 'object') { forwardedChatError.ts
127 return undefined;
128 }
129 const error = (parsed as { error?: unknown }).error;
130 > if (!error || typeof error !== 'object') { forwardedChatError.ts
131 return undefined;
132 }
133 const code = (error as { code?: unknown }).code;
134 const msg = (error as { message?: unknown }).message;
135 > if (typeof code !== 'string' && typeof msg !== 'string') { forwardedChatError.ts
136 return undefined;
137 }
138 return {
139 > code: typeof code === 'string' ? code : undefined, forwardedChatError.ts
140 > message: typeof msg === 'string' ? msg : undefined,
141 > };
142 > }
143
144 /**