don't send stack errors

This commit is contained in:
Nour Alharithi
2023-11-24 16:05:29 -08:00
parent 5a41083373
commit 9940110094
2 changed files with 24 additions and 9 deletions

View File

@@ -212,11 +212,7 @@ const main = async () => {
await userMap.subscribe();
const userStatsMap = new UserStatsMap(driftClient, {
type: 'polling',
accountLoader: new BulkAccountLoader(
connection,
stateCommitment,
0
),
accountLoader: new BulkAccountLoader(connection, stateCommitment, 0),
});
await userStatsMap.subscribe();

View File

@@ -131,11 +131,20 @@ async function main() {
ws.send(
JSON.stringify({
channel: requestChannel,
error: error.message,
error:
'Error subscribing to channel with data: ' +
JSON.stringify(parsedMessage),
})
);
} else {
ws.close(1003, JSON.stringify({ error: error.message }));
ws.close(
1003,
JSON.stringify({
error:
'Error subscribing to channel with data: ' +
JSON.stringify(parsedMessage),
})
);
}
return;
}
@@ -189,14 +198,24 @@ async function main() {
} catch (error) {
const requestChannel = safeGetRawChannelFromMessage(parsedMessage);
if (requestChannel) {
console.log('Error unsubscribing from channel:', error.message);
ws.send(
JSON.stringify({
channel: requestChannel,
error: error.message,
error:
'Error unsubscribing from channel with data: ' +
JSON.stringify(parsedMessage),
})
);
} else {
ws.close(1003, JSON.stringify({ error: error.message }));
ws.close(
1003,
JSON.stringify({
error:
'Error unsubscribing from channel with data: ' +
JSON.stringify(parsedMessage),
})
);
}
return;
}