better error handling

This commit is contained in:
Para Dox
2025-06-01 20:54:54 +07:00
parent c37c53f4f9
commit fcdee01608

View File

@@ -252,8 +252,11 @@ class RPCProxy {
// Capture and stream the response // Capture and stream the response
response.data.on('data', (chunk) => { response.data.on('data', (chunk) => {
// Always capture data for comparison purposes
responseData += chunk.toString();
// Only write to client if still connected
if (!isClientClosed() && !res.writableEnded) { if (!isClientClosed() && !res.writableEnded) {
responseData += chunk.toString();
try { try {
res.write(chunk); res.write(chunk);
} catch (writeError) { } catch (writeError) {