Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions packages/core/src/ide/ide-connection-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,13 +215,19 @@ export async function createProxyAwareFetch(ideServerHost: string) {
};
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
const options = fetchOptions as unknown as import('undici').RequestInit;
const response = await fetchFn(url, options);
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
return new Response(response.body as ReadableStream<unknown> | null, {
status: response.status,
statusText: response.statusText,
headers: [...response.headers.entries()],
});
try {
const response = await fetchFn(url, options);
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to not disable this lint rule?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hey, that disable was already there before my changes — I just wrapped the existing code in a try/catch. the cast is needed because Node's RequestInit and undici's RequestInit don't play nice with each other, so going through unknown is the only option there.

return new Response(response.body as ReadableStream<unknown> | null, {
status: response.status,
statusText: response.statusText,
headers: [...response.headers.entries()],
});
} catch (error) {
const urlString = typeof url === 'string' ? url : url.href;
Comment thread
yuvrajangadsingh marked this conversation as resolved.
Comment thread
yuvrajangadsingh marked this conversation as resolved.
logger.error(`IDE fetch failed for ${urlString}`, error);
throw error;
}
};
}

Expand Down
Loading