diff --git a/backend/src/controllers/participant.controller.ts b/backend/src/controllers/participant.controller.ts index 118fbc9..12523d0 100644 --- a/backend/src/controllers/participant.controller.ts +++ b/backend/src/controllers/participant.controller.ts @@ -73,9 +73,17 @@ export const refreshParticipantToken = async (req: Request, res: Response) => { export const deleteParticipant = async (req: Request, res: Response) => { const logger = container.get(LoggerService); + const roomService = container.get(RoomService); const participantService = container.get(ParticipantService); const { roomId, participantName } = req.params; + // Check if the room exists + try { + await roomService.getMeetRoom(roomId); + } catch (error) { + return handleError(res, error, `getting room '${roomId}'`); + } + try { logger.verbose(`Deleting participant '${participantName}' from room '${roomId}'`); await participantService.deleteParticipant(participantName, roomId); diff --git a/backend/src/services/livekit.service.ts b/backend/src/services/livekit.service.ts index 9dda4e6..1b78cd1 100644 --- a/backend/src/services/livekit.service.ts +++ b/backend/src/services/livekit.service.ts @@ -158,7 +158,7 @@ export class LiveKitService { return await this.roomClient.getParticipant(roomName, participantName); } catch (error) { this.logger.warn(`Participant ${participantName} not found in room ${roomName}: ${error}`); - throw internalError(`getting participant '${participantName}' in room '${roomName}'`); + throw errorParticipantNotFound(participantName, roomName); } }