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(); await userMap.subscribe();
const userStatsMap = new UserStatsMap(driftClient, { const userStatsMap = new UserStatsMap(driftClient, {
type: 'polling', type: 'polling',
accountLoader: new BulkAccountLoader( accountLoader: new BulkAccountLoader(connection, stateCommitment, 0),
connection,
stateCommitment,
0
),
}); });
await userStatsMap.subscribe(); await userStatsMap.subscribe();

View File

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