fix: close SSE stream when error occurred

This commit is contained in:
2024-09-22 16:23:38 -04:00
parent 15f680c4d0
commit 6f35e2cdea

View File

@@ -212,7 +212,8 @@ app.openapi(route, async (c) => {
async (err, stream) => { async (err, stream) => {
console.error("Error occurred in SSE"); console.error("Error occurred in SSE");
console.error(err); console.error(err);
stream.writeln("An error occurred"); await stream.writeln("An error occurred");
await stream.close();
}, },
); );
}); });