Suppress SSE proxy errors on expected upstream socket close (#799)
When the upstream OpenCode process restarts, the fetch connection is terminated by the remote side (UND_ERR_SOCKET / "other side closed"). Previously the catch block would log this as a warning and the VSCode sseProxy would reject its run promise (sending an error to the webview) even though the termination was normal. Now both handlers treat UND_ERR_SOCKET the same way they treat an explicit abort. Co-authored-by: Bohdan Triapitsyn <artmore@protonmail.com>
This commit is contained in:
committed by
GitHub
co-authored by
Bohdan Triapitsyn
parent
ed9d31c681
commit
598e28462a
@@ -126,10 +126,17 @@ export const openSseProxy = async ({
|
||||
|
||||
const result = await connect();
|
||||
const run = (async () => {
|
||||
for await (const _ of result.stream) {
|
||||
void _;
|
||||
if (signal.aborted) {
|
||||
break;
|
||||
try {
|
||||
for await (const _ of result.stream) {
|
||||
void _;
|
||||
if (signal.aborted) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (error: unknown) {
|
||||
const cause = (error as { cause?: { code?: string } } | null)?.cause;
|
||||
if (!signal.aborted && cause?.code !== 'UND_ERR_SOCKET') {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user