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
|
// Add methods to manage room users
|
||||||
const addUserToRoom = async (bodyshopUUID, user) => {
|
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) => {
|
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 getUsersInRoom = async (bodyshopUUID) => {
|
||||||
const users = await pubClient.sMembers(`bodyshopRoom:${bodyshopUUID}`);
|
try {
|
||||||
return users.map((user) => JSON.parse(user));
|
const users = await pubClient.sMembers(`bodyshopRoom:${bodyshopUUID}`);
|
||||||
|
return users.map((user) => JSON.parse(user));
|
||||||
|
} catch (err) {
|
||||||
|
console.error(`Error getUsersInRoom: ${bodyshopUUID}`);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const api = {
|
const api = {
|
||||||
|
|||||||
Reference in New Issue
Block a user