IO-2935-Add-Enhanced-Websocket-Provider - Add additional try catch statements
Signed-off-by: Dave Richer <dave@imexsystems.ca>
This commit is contained in:
@@ -74,16 +74,28 @@ const applyRedisHelpers = (pubClient, app) => {
|
||||
|
||||
// Add methods to manage room users
|
||||
const addUserToRoom = async (bodyshopUUID, user) => {
|
||||
await pubClient.sAdd(`bodyshopRoom:${bodyshopUUID}`, JSON.stringify(user));
|
||||
try {
|
||||
await pubClient.sAdd(`bodyshopRoom:${bodyshopUUID}`, JSON.stringify(user));
|
||||
} catch (err) {
|
||||
console.error(`Error adding user to room: ${bodyshopUUID}`);
|
||||
}
|
||||
};
|
||||
|
||||
const removeUserFromRoom = async (bodyshopUUID, user) => {
|
||||
await pubClient.sRem(`bodyshopRoom:${bodyshopUUID}`, JSON.stringify(user));
|
||||
try {
|
||||
await pubClient.sRem(`bodyshopRoom:${bodyshopUUID}`, JSON.stringify(user));
|
||||
} catch (err) {
|
||||
console.error(`Error remove user from room: ${bodyshopUUID}`);
|
||||
}
|
||||
};
|
||||
|
||||
const getUsersInRoom = async (bodyshopUUID) => {
|
||||
const users = await pubClient.sMembers(`bodyshopRoom:${bodyshopUUID}`);
|
||||
return users.map((user) => JSON.parse(user));
|
||||
try {
|
||||
const users = await pubClient.sMembers(`bodyshopRoom:${bodyshopUUID}`);
|
||||
return users.map((user) => JSON.parse(user));
|
||||
} catch (err) {
|
||||
console.error(`Error getUsersInRoom: ${bodyshopUUID}`);
|
||||
}
|
||||
};
|
||||
|
||||
const api = {
|
||||
|
||||
Reference in New Issue
Block a user